Hi,
I submitted a pull request that handles this (passing tables as
parameters). This involved creating a new NHibernate IType (StructuredType)
and SqlType (StructuredSqlType).
Because the SQL Server's implementation needs to take the name of the type
(table-valued parameter), I propose the following convention: set the type
as the DataTable name, as in:
var table = new DataTable("dbo.TableType");
table.Columns.Add("a", typeof (int));
table.Columns.Add("b", typeof(int));
table.Rows.Add(1, 2);
var result = session.CreateSQLQuery("EXEC dbo.TableProcedure
:t").SetParameter("t", table).List();
The type must be passed, there is no other way. The only way I see is to
explicitly pass the type as a parameter, which is also supported:
var result = session.CreateSQLQuery("EXEC dbo.TableProcedure
:t").SetParameter("t", table,
NHibernateUtil.Structured("dbo.TableType")).List();
Let me know if it solves your problem.
RP
On Wednesday, November 19, 2014 3:26:28 PM UTC, Satish Kumar wrote:
>
> Thanks for the reply with below link, As per the below url we can pass
> collection of values to procedure for that I have to loop through all
> values for each column, even I found another url (
> http://klausnji.wordpress.com/2014/01/11/returning-an-ienumerable-using-nhibernate-and-stored-procedures/)
>
> this link also executes the same for collection values. But I need to send
> complete DataTable as input parameter to SQL Server stored procedure,
> please let me know if any solution. Thanks in advance :)
>
>
> On Wednesday, November 19, 2014 3:43:15 AM UTC-5, ENOTTY wrote:
>>
>>
>> https://stackoverflow.com/questions/3701364/nhibernate-sqldbtype-structured
>>
>>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.