If only there were an easy way to move from using EF6 to EF Core using Database First. I recently was given the job of taking an EF6 implementation of a DAL and porting it to EF Core. It was hell.

There were several tools available for this, but we chose EF Core Power Tools because it was free, and I was able to write a Powershell script that would translate the EDMX file and all of its properties that mapped to columns into the json that the Tools required.

At first it seemed it would work easily. The tool took everything from our databases and spit out the json and Entities...a EF Model. But, the problem was, we had renamed many of the POCO properties to something more readable than the column names in our GIANT database server. With all of this in mind, you can think that this would have been rectified by the Powershell script, but a big part of the drudgery of the system was capital and lowercase letters. The Tools translated column name that were mapped to the Entity property names having strange non-camel casing. And, even if it was a casing format, it would have not matched our naming conventions or lack thereof.

I separated all of the databases and made all the config files and json files for things like navigations and the entity properties alike. But, it was just a rabbit hole going deeper and deeper and deeper into perpetuity for renaming and adding entries into the json. There was also an issue with properties not even being there from the Powershell script because of the EDMX file. I had to cut up the EDMX file anyway. That was some manual drudgery, but the renaming was driving me nuts. It just would not end.

I mentioned all this to the person in charge of the project, and he said just to abort. It wasn't a bad thing, it was a successful failure. We tried and learned, and I know with enough time it could have been done. There was a clear path to success. It was just a waste of time. We kept all of the work.

According to Microsoft, they will be producing a command line database first approach tool that will help to ease the refactoring of the whole project, but no one has done it. There is just this empty thread on GitHub about it. No one seems to be picking up the chisel and doing it. I am not sure about the rest of the tools we were looking at, but there are much more valuable things we are needing to be doing. This is just horrendous. Our EF6 implementation works, and it is stable. It just won't be around forever...

EntityFramework.Docs/entity-framework/core/cli/dotnet.md at main · dotnet/EntityFramework.Docs
Documentation for Entity Framework Core and Entity Framework 6 - dotnet/EntityFramework.Docs