.net core EF
如何從DB 自動生成 EF 程式碼(Model)
使用 Scaffold-DbContext 指令
Scaffold-DbContext [-Connection] [-Provider] [-OutputDir]
[-Context]
[-Schemas>] [-Tables>] [-DataAnnotations] [-Force]
[-Project] [-StartupProject] [<CommonParameters>]
EX:
Scaffold-DbContext "Server=ServerIP;Database=DBNAME;User ID=User;Password=password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -Context [ContexName] -OutputDir [DirName] -Tables [TableName1],[TableName2] -Force
留言