"EdmFunctions"有什么用? [英] what are 'EdmFunctions' for?
问题描述
我偶然看到了System.Data.Common.CommandTrees.ExpressionBuilder.EdmFunctions
静态类,该类在System.Data.Common.CommandTrees.DbExpression
上包含一组扩展方法,例如AddDays,Concat等.它们将System.Data.Common.CommandTrees.DbFunctionExpression
用作返回类型,如果需要,可以使用此静态方法作为参数,它们仅接受System.Data.Common.CommandTrees.DbExpression
类型,此外,我查看了System.Data.Common.CommandTrees.DbExpression
,并且我看到此类是抽象的,并且可以通过其静态成员创建System.Data.Common.CommandTrees.DbExpression
并将其发送给System.Data.Common.CommandTrees.ExpressionBuilder.EdmFunctions
以使用扩展方法
i saw the System.Data.Common.CommandTrees.ExpressionBuilder.EdmFunctions
static class accidently, that contains a set of extension methods on System.Data.Common.CommandTrees.DbExpression
, like AddDays, Concat,.... which bring back System.Data.Common.CommandTrees.DbFunctionExpression
as return type, this static methods if needs to an argument, they only accept a System.Data.Common.CommandTrees.DbExpression
type, in addition i look over the System.Data.Common.CommandTrees.DbExpression
and i saw this class is abstract and by its static members you can create a System.Data.Common.CommandTrees.DbExpression
, and send them to System.Data.Common.CommandTrees.ExpressionBuilder.EdmFunctions
to use its extension methods,
我的问题是:
- 这些扩展是做什么用的?
- 我们如何以及在何处使用此扩展方法?
- 具有这些扩展方法映射到
canonical functions
并作为Linq
中使用的辅助方法,例如System.Data.Objects.EntityFunctions
的方法或System.Data.Objects.SqlClient.SqlFunctions
的方法?
- what are these extensions for ?
- how and where can we use this extension methods ?
- have these extension methods mapped to
canonical functions
and are as helper method for using inLinq
, likeSystem.Data.Objects.EntityFunctions
's methods orSystem.Data.Objects.SqlClient.SqlFunctions
's Methods ?
有一个名为System.Data.Metadata.Edm.EdmFunction
的属性,这样,您可以创建CLR
函数并将它们映射到创建的model-defined functions
中,以便在Linq
中使用,
whereas there is a attribute with name System.Data.Metadata.Edm.EdmFunction
and by this, you can create CLR
functions and map them to created model-defined functions
for using in Linq
,
- 这些之间有关系吗?
您可以附上任何样品吗?或链接到任何文档?
could you attach any sample? or link to any documentaion?
推荐答案
这些方法不适合一般使用,您继续在客户端代码中使用SqlFunctions
或EntityFunctions
.它们是可以在任意提供程序上执行的规范功能的常规实现. Microsoft包括XML,BCL集合和Entity SQL的提供程序.其他人可以为他们自己的dbase引擎或ORM创建提供程序.
These methods are not meant for general consumption, you continue to use SqlFunctions
or EntityFunctions
in client code. They are the stock implementations of the canonical functions that can execute on an arbitrary provider. Microsoft includes the providers for XML, BCL collections and Entity SQL. Somebody else can create a provider to, say, their own dbase engine or ORM.
例如从 EdmFunctions.AddDays()
在执行查询理解时动态发生.
The mapping from, say, EntityFunctions.AddDays()
to EdmFunctions.AddDays()
occurs dynamically when the query comprehension is executed.
这篇关于"EdmFunctions"有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!