Upgrading legacy Entity Framework 4.0 to 5.0

188 Views Asked by At

We have a .NET Framework 4.0/WPF application that was recently updated to .NET Framework 4.8. As part of this same round of updates, we also wanted to upgrade our Entity Framework libraries.

Our Entity Framework implementation is utilizing ObjectContext and Self Tracking Entities (STE's).

After attempting to upgrade Entity Framework to 6.x using the Nuget Package Manager, I quickly ran into issues. I discovered here that the STE code generation templates were no longer available for ObjectContext/STE:

enter image description here

However, I did find a STE code generation template here compatible with Entity Framework 5. I felt like that was an acceptable compromise, so I decided to upgrade to Entity Framework 5 instead.

When I downloaded Entity Framework 5 using Nuget, the only thing it added to my project was a new EntityFramework.dll.: enter image description here

Next, I deleted my existing .tt code generation templates for STE's. I right-clicked my model (edmx file), clicked Add Code Generation item, and selected the new STE code generation template that I downloaded which claimed to be compatible with Entity Framework 5.

This all ran fine; however, none of the code that was generated was using anything in this new EntityFramework.dll. Everything seems to be coming from System.Data.Entity (now at 4.8). In fact, I can even remove EntityFramework.dll altogether, and everything seems to compile.

So, is this "upgrade" even doing anything for me?

(1) What version of Entity Framework am I even using? Since I'm using System.Data.Entity from .NET Framework 4.8, am I still using Entity Framework 4 or have I updated by virtue of a Framework update?

(2) Since I'm using ObjectContext/STE's, can I even benefit from adding this EntityFramework.dll for 5.0?

0

There are 0 best solutions below