Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
EF6: Document workaround to use EDMX files with EF 6.3 on .NET Core #1748
I think we should also consider moving the code sample to this repo (currently it is in my personal GitHub account) and update the aka.ms link.
From the preview 9 blog post:
How to work with EDMX files in .NET Core projects
On the tooling side, we plan to release an updated EF6 designer in an upcoming update of Visual Studio 2019 which will work with projects that target .NET Core (tracked in issue #883). Until this new version of the designer is available, we recommend that you work with your EDMX files inside projects that target .NET Framework. You can then add the EDMX file and the generated classes for the entities and the DbContext as linked files to a .NET Core 3.0 or .NET Standard 2.1 project in the same solution. For example, the project file for the .NET Core project can include the linked files like this:
<ItemGroup> <EntityDeploy Include="..\EdmxDesignHost\Entities.edmx" Link="Model\Entities.edmx" /> <Compile Include="..\EdmxDesignHost\Entities.Context.cs" Link="Model\Entities.Context.cs" /> <Compile Include="..\EdmxDesignHost\Thing.cs" Link="Model\Thing.cs" /> <Compile Include="..\EdmxDesignHost\Person.cs" Link="Model\Person.cs" /> </ItemGroup>
Thank you for the sample. It took me a while to figure out that I ofc have to change the namespaces of the generated files when I try to do the process in my own project. Also, if I change anything in the edmx, everything will be regenerated on save and all the namespaces will go back to the EF6 project. Is there a way to change the default namespace for the generated files or is there some kind of workaround I should know about?