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):
Inside project.json:
Inside Startup.cs:
Next:
And finally:
Note that you can use another project called MR.AspNet.Identity.EntityFramework6 to bridge Asp.Net Core Identity with Entity Framework 6.
you cannot use
Entity Framework 6
with .Net Core 1.0. There is aEntity Framework Core 1.0
package developed specifically for.Net Core 1.0
. You need to install it to use in .Net Core 1.0 project.https://blogs.msdn.microsoft.com/dotnet/2016/06/27/entity-framework-core-1-0-0-available/
Install using Nuget Package Mangager Console.
PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer
Add a new migration (If it’s the first one, it will add the neccessary folder structure and classes)
dotnet ef migrations add {MigrationName}
Remove the most recent migration.
dotnet ef migrations remove
Update the database the latest version (apply all migrations)
dotnet ef database update
http://benjii.me/2016/05/dotnet-ef-migrations-for-asp-net-core/
You can find so many articles in google.