[SOLVED] With Entity Framework Core (EF Core), how do you generate the EF model and the entities?
Scaffold-DbContext
Generate code for all tables in the database using Ef Core:
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Tables "Blog","Post" -ContextDir Context -Context BlogContext -ContextNamespace New.Namespace
Generate code for specific tables selected in the database using Ef Core::
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Tables "Blog","Post" -ContextDir Context -Context BlogContext -ContextNamespace New.Namespace
Hope it can help.
إرسال تعليق
Thank for leaving message