I created an ASP.NET Core 1 project and using .Net Core 1.0 framework. And want to use the Entity Framework 6.
I follow this tutorials https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html and when I try to migrate with the statement:
PM> Add-Migration MyFirstMigration
then it shows me:
The EntityFramework package is not installed on project 'IndustryCloud'.
It is possible to use EF6 with ASP.NET Core 1?
You can use
Entity Framework 6 with ASP.Net Core 1.0. An example application can be found on Github.
In order to make it work, you have to follow the instructions from the repo (below I paste the crucial parts, but I encourage you to check the ones from repository):
- Remove netcoreapp1.0 from the target frameworks and add net451.
- Remove everything EF Core and add Migrator.EF6.Tools + EF6 to your dependencies
- Remove everything EF Core related.
- Simply add your db context to services:
Remove the "Migrations" or the "Data/Migrations" folder that EF Core generated.
dotnet ef migrations enable dotnet ef migrations add InitialCreate dotnet ef database update
Note that you can use another project called MR.AspNet.Identity.EntityFramework6 to bridge Asp.Net Core Identity with Entity Framework 6.