Is it possible to use `SqlDbType.Structured` to pass Table-Valued Parameters in NHibernate?

前端 未结 4 806
花落未央
花落未央 2020-12-04 16:12

I want to pass a collection of ids to a stored procedure that will be mapped using NHibernate. This technique was introduced in Sql Server 2008 ( more info here => Table-Val

4条回答
  •  一个人的身影
    2020-12-04 16:51

    You can pass collections of values without the hassle.

    Example:

    var ids = new[] {1, 2, 3};
    var query = session.CreateQuery("from Foo where id in (:ids)");
    query.SetParameterList("ids", ids);
    

    NHibernate will create a parameter for each element.

提交回复
热议问题