ASP.Net Identity - Use custom Schema

后端 未结 3 1324
一整个雨季
一整个雨季 2020-12-05 07:57

I am using MVC5 + Ef6 code first with ASP.Net Identity 1.0 and wish to have the tables created in a custom schema. i.e. a schema that is not the dbo schema.

I revers

3条回答
  •  有刺的猬
    2020-12-05 08:42

    public class MyDbContext : EntityDbContext
    {
        public DbSet Users { get; set; }
    
        public MyDbContext() : base()
        {
        }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
    
            // You can globally assign schema here
            modelBuilder.HasDefaultSchema("schemaName");
        }
    }
    

提交回复
热议问题