开发者

DIFFERENCE in Linq [duplicate]

开发者 https://www.devze.com 2023-04-02 10:03 出处:网络
This qu开发者_StackOverflow社区estion already has answers here: Closed 11 years ago. Possible Duplicate:
This qu开发者_StackOverflow社区estion already has answers here: Closed 11 years ago.

Possible Duplicate:

Does Linq have "Difference"?

How to convert the following SQL Query to Linq

SELECT * FROM Designation WHERE DIFFERENCE(EmpDesg, ‘Engineer’) >= 3


You need to write a stored procedure and bring it into your context, define a user-defined function (if you're using EF) or you need to be willing to just execute a raw SQL query through the context. You can't access DIFFERENCE using LINQ to SQL directly (there is no LINQ query opeartor that will be translated into T-SQL DIFFERENCE).


Does Linq have "Difference"?

Summary:

  • Create User-Defined SQL Function
  • Add that function to your DBML diagram
  • Call that function in your WHERE clause
0

精彩评论

暂无评论...
验证码 换一张
取 消