EntityFrameworkCore
EntityFrameworkCore database first
Was as difficult as these things are. Here's some brief notes.
For help in the Package Manager type:
PM> Get-Help about_EntityFrameworkCore
PM> Get-Help about_EntityFrameworkCore
To scaffold an existing database:
PM> Scaffold-DbContext "Data Source=local\db;Initial Catalog=MyTable;Persist Security Info=True; User ID=BillyDoor;Password=XXXXX" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -ContextDir Context -Context MegaProjContext -project MegaProj
PM> Scaffold-DbContext "Data Source=local\db;Initial Catalog=MyTable;Persist Security Info=True; User ID=BillyDoor;Password=XXXXX" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -ContextDir Context -Context MegaProjContext -project MegaProj
If using ASP.NET Core Web App.
Add this bad boy to the Startup.ConfigurationServices:
services.AddDbContext<MegaProjContext>();
Add this bad boy to the Startup.ConfigurationServices:
services.AddDbContext<MegaProjContext>();
Add EF Core powertools to Visual Studio
For an stored procedure: Use EF Core Power Tools.
Reverse engineer any DB item using the EF Core powertools.
Reverse engineer any DB item using the EF Core powertools.
Summary
Not much else to add.
Hope it's been useful.