简体   繁体   中英

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,

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 ?

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 ,

  • 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. 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.

The mapping from, say, EntityFunctions.AddDays() to EdmFunctions.AddDays() occurs dynamically when the query comprehension is executed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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