entity framework - EF: What is the SQL output when using Contains in LINQ query? -


in nhibernate when execute query 1 below sql generated contains parameters each element in collection. if query executed against mssql server , there 2k or more elements in collection error because max parameters allowed sql engine 2k.

var bankaccounts = b in this.unitofwork.bankaccounts                     command.ids.contains(b.id) // command.ids array id's                     select b; 

sorry being lazy test myself entityframework see other developers writing such code: ef cannot delete child object because of associationset

the question sql generated ef kind of queries?

i've watched sql profiler you. happens in entity framework (i quess wat nhibernate product, i'm not sure..):

select  [extent1].[id] [id],  [extent1].[accountno] [accountno],  [extent1].[name] [name],  [extent1].[description] [description],  [extent1].[iban] [iban],  [extent1].[isactive] [isactive],  [extent1].[customer_id] [customer_id] [dbo].[bankaccounts] [extent1] [extent1].[id] in (4,5,6,7,9) 

as can see, become where .. in ([the contains values])


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -