Entity Framework core 7.0 ( DB First Approach & Code First Approach) | .NET 7 Updates

Nihira Techiees
Nihira Techiees
25.8 هزار بار بازدید - 2 سال پیش - #efcore
#efcore #dotnetcore #nihiratechiees

This video explains Entity Framework core 7.0 in .NET Core with DB First & Code Approaches.

 The Entity Framework provides three approaches to create an entity model

  1, Database First
  2, Code First
  3, Model First

Required packages
================
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools

Structure of scaffold command is shown below

     Scaffold-DbContext [-Connection] [-Provider] [-OutputDir] [-Context] [-Schemas] [-Tables]
                   [-DataAnnotations] [-Force] [-Project] [-StartupProject] [CommonParameters]

 1, Connection – used to provide connection string

 2, Provider – used to provide the Provider info

 3, OutputDir – Generate model in specific folder

 4,  Context  - provide name of our database context

 5, contextDir - Generate dbcontext in specific folder

 6, tables – generate models for specific tables

 7, DataAnnotations – Generate models with data annotations

8,  Force – forcedly updating the existing files

Sample Scaffold command
=======================
Scaffold-DbContext –connection name=constring  Microsoft.EntityFrameworkCore.SqlServer -OutputDir Repos/Models –context dbfirstcontext –contextDir Repos –DataAnnotations -f


GitHub Source code link
====================
https://github.com/nihira2020/Dotnet7...

Join this channel to get access to perks:
@nihiratechiees
2 سال پیش در تاریخ 1401/09/16 منتشر شده است.
25,867 بـار بازدید شده
... بیشتر