Update entity class in ASP.NET Core Entity Framework

前端 未结 2 1737
逝去的感伤
逝去的感伤 2021-02-05 03:34

I have created the model from existing database using Entity Framework in ASP.NET Core.

Here is the model of the Market table

public parti         


        
2条回答
  •  囚心锁ツ
    2021-02-05 04:03

    To Update entire dbcontext use the below command. link for more details

    "Build failed" on Database First Scaffold-DbContext

    Scaffold-DbContext -Connection "Server=(local);Database=DefenderRRCart;Integrated Security=True;Trusted_Connection=True;" -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir RRStoreContext.Models -context RRStoreContext -Project RR.DataAccess -force
    

    To update from Azure Connection and local Connection

    Scaffold-DbContext "Server=,1433;Initial Catalog=;Persist Security Info=False;User ID=;Password=;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Entity -context  -Project  -force
    

    To create the new Context

    Scaffold-DbContext "Server=,1433;Initial Catalog=;Persist Security Info=False;
            User ID=;Password=;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection
            Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir 
    

提交回复
热议问题