如何将以下sql语句转换为
linq查询?
select ID,Price,dbo.fGetText(DescriptionID,defaultLanguage,currentUserLanguage) from Products
UDF fGetText非常实用,并且在整个代码库中使用,因此需要进行封装(作为UDF或其他方式,可能是Linq Expression).
非常感谢您的帮助.非常感谢.
解决方法
这是MSDN文章:
How to: Call User-Defined Functions Inline (LINQ to SQL)
来自同一页面的说明:
Although you can call user-defined
functions inline,functions that are
included in a query whose execution is
deferred are not executed until the
query is executed. For more
information,see Introduction to LINQ
Queries.When you call the same function
outside a query,LINQ to sql creates a
simple query from the method call
expression
另外,看看这个13 min screencast.