如何获得用于特定DbContext的“ providerName”?

时间:2019-10-20 10:03:00

标签: entity-framework connection-string

OnModelCreating函数中,我可以获取用于此DbConnection实例的DbContext对象,但是如何获取providerName呢?

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{

     // this.Database.Connection ==> this returns the DbConnection object
     // but I couldn't find the providerName
}

我找到了this question,但没有得到答案。