This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I realise this might be a long shot, but.... is it possible to have LightSpeed generate SQL like this in SQL server, with the list of values being passed from (app to database) by a table valued function? ... where foo.Id in (list-of-ids) I know I could do this with a stored proc, as shown here: http://www.mindscapehq.com/forums/thread/271231 , but I'd really like to be able to do it with LINQ. Something like having a List of Int, and then doing list.Contains(myEntity.Id) in the LINQ where clause. Is that possible? Thanks, John |
|
|
Hi John, Are you meaning you want to pass the data using a table value parameter? e.g. http://msdn.microsoft.com/en-us/library/bb675163.aspx - if so we dont support those but you could use IUnitOfWork.PrepareCommand to give yourself an ADO.NET command object where you could then make the call yourself. Your example though deals with a list of id's so presumably you wouldnt actually want to use a table to pass this specific set of data. Normally for that example you can just use a local list of values and we will pass them down as a set of parameters (which is actually how the TVP's work behind the scenes anyway funnily enough) - e.g.
|
|
|
Hi Jeremy, Yes, I was meaning passing data in that way. The list of ID's approach looks like it might be the best option. IIRC, when I tried it some years ago in Linq to SQL the downside was that the number of params varied on each call (since the size of our list tended to vary) so the query plan was not cached by SQL Server. But that turned out not to be a big deal in practice. Thanks for the suggestion. John |
|