nuget 安裝 : Microsoft.Data.SqlClient、ErikEJ.EntityFramework.SqlServer
連線字串加入 TrustServerCertificate=True 避免遇到錯誤訊息 : A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - 此憑證鏈結是由不受信任的授權單位發出的
例: Server=xxx; Database=xxx;TrustServerCertificate=True;
繼承 dbcontext 的class加入attribute
[System.Data.Entity.DbConfigurationType(typeof(System.Data.Entity.SqlServer.MicrosoftSqlDbConfiguration))]
public partial class xxxContext : DbContext