william-r
10/31/2017 - 9:43 PM

EF6 .Net Core 2 Existing Database

Setup Entity Framework 6 in .Net Core 2 doing the Existing Database

#Install Nuget Packages
Install-Package Microsoft.EntityFrameworkCore.SqlServer
Install-Package Microsoft.EntityFrameworkCore.Tools
Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design

#Reverse engineer the models
Scaffold-DbContext "Server=.\SQLEXPRESS;Database=MyDatabase;Integrated Security=true;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

#Replace ".\SQLEXPRESS" with our SQL server
#Replace "MyDatabase" with our SQL database
#Replace "Models" with your desired folder