简体   繁体   English

“ EdmFunctions”有什么用?

[英]what are 'EdmFunctions' for?

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, 我偶然看到了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以使用其扩展方法,

my questions are: 我的问题是:

  • 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 in Linq , like System.Data.Objects.EntityFunctions 's methods or System.Data.Objects.SqlClient.SqlFunctions 's Methods ? 这些扩展方法是否已映射到canonical functions并且可以作为在Linq使用的辅助方法,例如System.Data.Objects.EntityFunctions的方法或System.Data.Objects.SqlClient.SqlFunctions的方法?

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 , 而有一个名称为System.Data.Metadata.Edm.EdmFunction的属性,通过此属性,您可以创建CLR函数并将其映射到创建的model-defined functions ,以供在Linq使用,

  • is there a relation between these ? 这些之间有关系吗?

could you attach any sample? 你能附上样品吗? or link to any documentaion? 或链接到任何文献资料?

These methods are not meant for general consumption, you continue to use SqlFunctions or EntityFunctions in client code. 这些方法不适合一般使用,您可以继续在客户端代码中使用SqlFunctionsEntityFunctions 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. Microsoft包括XML,BCL集合和Entity SQL的提供程序。 Somebody else can create a provider to, say, their own dbase engine or ORM. 其他人可以为他们自己的dbase引擎或ORM创建提供程序。

The mapping from, say, EntityFunctions.AddDays() to EdmFunctions.AddDays() occurs dynamically when the query comprehension is executed. 当执行查询理解时,从EntityFunctions.AddDays()EdmFunctions.AddDays()的映射会动态发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM