There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?

2

Closed

Consider bringing back EntityFunctions and EdmFunctionAttribute

description

When we merged the core EF functionality into EntityFramework.dll we did some refactorings. In particular, we renamed and moved the EntityFunctions class to align it with the DbContext API. However, in most other cases afterwards we have leaned towards
not introducing unnecessary breaking changes.

This item is here just so we remember to discuss if we want the original API to still be available in EF6 to facilitate the migration of existing applications.

comments

I have investigated this and it is easy. The functions can be added in both places with the EntityFunctions versions delegating to the DbFunctions versions. A small change is required in LINQ to Entities to deal with the EDM function members of the class--the
Unicode methods. We do end up with two copies of each method, but neither copy has any significant implementation (they are really just stubs) so I think this is okay.

For the attribute, EdmFunctionAttribute can be added back as a class that derives from DbFunctionAttribute. This requires no other changes to work.

We should decide whether or not to put an Obsolete attribute on the Entity/Edm classes. The advantage of this is that people bringing old code over will be able to find the classes and they will even work, but they will get a compile time warning indicating
that they should use the new versions. On the other hand, there is no real reason why we need to obsolete them, so we could just let people happily continue to use whichever ones they want.

WhoMovedMyWensleydale (Add back EdmFunctionAttribute and EntityFunctions)

For EF6 these classes were moved to the top-level namespace and renamed to DbFunctions and DbFunctionAttribute. However, this has caused more confusion than expected with people not being able to find the moved classes. This change puts back versions of these
classes with their original names so that people can easily find them. The classes with the old names basically just delegate to the new classes and are also marked as obsolete to help move people to the new classes.