Skip to content

nayanbunny/dotnet-efcore-model-first-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DotNet Entity Framework Core - Model First Approach Sample

ADO.Net Entity Data Model/Designer supports in .Net Framework but not in .Net/EF Core.

To port an EF6 Model EDMX-Based Model to EF Core, regenerate a new code-based model using Scaffold-DbContext.

In this approach, (EF Core) we model our entities and database context as code-based similar to Code-First. Then either using Migrations or DB Initializer, we create the database.

Language : C#
.Net Version : >=6.0

Pre-Requisites

  • Visual Studio IDE
  • Microsoft SQL Server
  • Azure Data Studio / SQL Server Management Studio (SSMS) / SSDT for Visual Studio

Scenario

  • Database with tables:
    • Departments (Departments data like Name, IsActive)
    • Employees (Employee data like Name, Email, Phone, DepartmentId, IsActive)
    • Skills (Skills data like Name, IsActive)
    • EmployeeSkills (Relation Mapping between Employee and Skill)
  • Each Employee belongs to a department and can have multiple skills.

Execution & Implementation Steps

References

EntityFrameworkCore
.Net Core MVC
.Net Core Razor Pages
EFCore - Get Started
EFCore - MVC
EF Core - Razor Pages
EF - Model First

🔥 Happy Coding