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

Поделиться
HTML-код
  • Опубликовано: 7 окт 2024
  • #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
    ====================
    github.com/nih...
    Join this channel to get access to perks:
    / @nihiratechiees

Комментарии • 30