EF Core DB First, and how to avoid Constructor Overwrite on Model Generation
问题 I am moving away from using SQL Authentication with my Azure DB, to Active Directory Managed Authentication as explained in this article. Basically, I'm doing two main things to get this working. 1- injecting the token in the DBContext constructor: public MyDBContext(DbContextOptions<MyDBContext> options) : base(options) { var conn = (SqlConnection)Database.GetDbConnection(); conn.AccessToken = (new Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProvider()).GetAccessTokenAsync(