如何在Identity 3中发送连接字符串?

时间:2016-03-29 19:09:00

标签: asp.net asp.net-identity

Identity 2中,我看到它有几个参数

 public ApplicationDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)
        {
        }

enter image description here

但是在Identity 3中它没有得到参数。我怎么能发送connectionString? enter image description here

1 个答案:

答案 0 :(得分:1)

在asp.net核心中,您必须覆盖OnConfiguring:

  protected override void OnConfiguring ( DbContextOptionsBuilder optionsBuilder)
 {
   var connString = ""; 

   optionsBuilder.UseSqlServer(connString);

   base.OnConfiguring(optionsBuilder);
}