求大神解答 EF的问题

l2999019 2015-05-14 01:58:45
今天遇到一个需要在LINQ中使用SQL方法的问题..
以前一直用的SqlFunctions对象,今天却报错了..
后来有大神说可以用EntityFunctions 还是报错..
最后用DbFunctions 就好了..
求大神解答这三个对象到底是什么情况? - - 有什么区别?
...全文
238 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
q107770540 2015-05-14
  • 打赏
  • 举报
回复
SqlFunctions is a static class introduced in EF4 and is in assembly System.Data.Entity. It contains a long list of methods like Cos, DateAdd, DateDiff, DatePart, GetDate, Exp, Sign, which are mapped to SQL Server functions. These static functions can be called in LINQ to Entities queries EF4 also introduced the static EntityFunctions class. This class exposes conceptual model canonical functions which can be used in LINQ to Entities queries. These functions are mapped to the functions in the System.Data.Metadata.Edm namespace and they are only available in the conceptual model. https://msdn.microsoft.com/en-us/library/system.data.objects.sqlclient.sqlfunctions.aspx https://msdn.microsoft.com/en-us/library/system.data.objects.entityfunctions.aspx
l2999019 2015-05-14
  • 打赏
  • 举报
回复
没人了么.
l2999019 2015-05-14
  • 打赏
  • 举报
回复
引用 1 楼 caozhy 的回复:
不同的Provider用的桩函数不同,一个是EF一个是LINQ to SQL
有三个啊 - - DbFunctions 呢?
threenewbee 2015-05-14
  • 打赏
  • 举报
回复
不同的Provider用的桩函数不同,一个是EF一个是LINQ to SQL

8,493

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 LINQ
社区管理员
  • LINQ
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧