How to use EF6 with ASP.NET Core 1

I created an ASP.NET Core 1 project and used the .NET Framework. And want to use Entity Framework 6 .
I follow these tutorials https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html and when I try to migrate using the instruction:

PM> Add-Migration MyFirstMigration

then he shows me:

The EntityFramework package is not installed on project 'IndustryCloud'.

Can I use EF6 with ASP.NET Core 1?

+4
source share
2 answers

You can use Entity Framework 6with ASP.Net Core 1.0. An example application can be found on Github .

, ( , ):

project.json:

  • netcoreapp1.0 net451.
  • EF Core Migrator.EF6.Tools + EF6 .

Startup.cs:

  • EF .
  • db : services.AddScoped<ApplicationDbContext>();

:

"Migrations" "Data/Migrations", EF Core.

:

dotnet ef migrations enable
dotnet ef migrations add InitialCreate
dotnet ef database update

, MR.AspNet.Identity.EntityFramework6, Asp.Net Entity Framework 6.

+3

Entity Framework 6 .Net Core 1.0. Entity Framework Core 1.0, .Net Core 1.0. .Net Core 1.0.

https://blogs.msdn.microsoft.com/dotnet/2016/06/27/entity-framework-core-1-0-0-available/

Mangager Nuget Package.

PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer

( , )

dotnet ef migrations add {MigrationName}

.

dotnet ef migrations remove

( )

dotnet ef database update

http://benjii.me/2016/05/dotnet-ef-migrations-for-asp-net-core/

Google .

0

All Articles