7.17.2018

Updating your EF models using Database First approach

In the .Net Core world, updating your Entity Framework Core models from a Database First approach is not very obvious. It certainly wasn't obvious to me. In the not so distant past, the process of adding or updating a table involved dragging or selecting the objects onto a convenient little canvas. This is still available, I believe, in Entity Framework non core versions. 

I find myself having to copy and paste this in to the Package Manager Console so often that I needed to put this somewhere easily retrievable - so here it is.
Scaffold-DbContext "Data Source=Blah;Initial Catalog=DataBase;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -force -OutputDir Models/DB

No comments:

Post a Comment