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.
Closed Apr 12, 2013 at 7:46 PM by mgirgin
Verified by Maurycy

comments

RoMiller wrote Jan 31, 2013 at 10:17 PM

EF Team Triage: Investigate if there is an easy/clean way to have them available in both places.

ajcvickers wrote Mar 3, 2013 at 1:13 AM

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.

RoMiller wrote Mar 7, 2013 at 10:38 PM

EF Team Triage: We will have both copies and Obsolete EntityFunctions.

ajcvickers wrote Mar 8, 2013 at 5:00 AM

Fixed in 4db815ad7dde

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.