ASP.NET Core - Auto Generate DbContext Class From Database | Scaffold-DBContext | Database First

preview_player
Показать описание
Auto Generate DbContext Class From Database In ASP.NET Core 5.0.
Creating a Model for an Existing Database in Entity Framework Core.

Here you will learn how to create the context and entity classes for an existing database in Entity Framework Core. Creating entity & context classes for an existing database is called Database-First approach.

EF Core does not support visual designer for DB model and wizard to create the entity and context classes similar to EF 6. So, we need to do reverse engineering using the Scaffold-DbContext command. This reverse engineering command creates entity and context classes (by deriving DbContext) based on the schema of the existing database.

scaffold dbcontext ef core
scaffold dbcontext build failed
.net core dbcontext
scaffold dbcontext command
scaffold dbcontext ef core tables
scaffold dbcontext ef core connection string
entity framework core
entity framework core database first
entity framework core tutorial
entity framework core 5
entity framework core code first
Рекомендации по теме
Комментарии
Автор

is that it will generate DbContext containing all the tables in the database. My current database is having over 1000 tables and I do not need all of them for the current project. Is there a way to target only specific tables that I need during the scaffolding process?

sahiaz
Автор

thank you tutorial,
Code// : Scaffold-DbContext "Data Source=XX-XXXX;Initial Security=True;Connect -OutputDir Database -Context ApplicationDbContext -DataAnnotations

andersonvalinhos