Sunday, March 27, 2011

How to call a UDF in a linq to sql query?

How would the following sql statement translate to a linq query?

select ID, 
       Price, 
       dbo.fGetText(DescriptionID, defaultLanguage, currentUserLanguage) 
from Products

The UDF fGetText is quite substantial and used throughout the code base, so it needs to be encapsulated (as a UDF or otherwise, perhaps a Linq Expression).

Extra round trips to the database server are not a option. There should only be one query, retrieving 3 fields.

Many thanks in advance for your help. It is greatly appreciated.

From stackoverflow

0 comments:

Post a Comment