0
我很想知道是否有可能將這兩個下面的類合併成一個類。是否可以從兩個上下文創建單個類?
第一的DbContext:
public class ApplicationDbContext : IdentityDbContext<BusinessAccount>
{
public ApplicationDbContext()
: base("MySQLConnectionString", throwIfV1Schema: false)
{
}
public DbSet<Sector> Sectors { get; set; }
public DbSet<Campus> Campuss { get; set; }
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
二的DbContext:
public class ApplicationDbContext :DbContext
{
public ApplicationDbContext()
: base("MySQLConnectionString")
{
}
public DbSet<Sector> Sectors { get; set; }
public DbSet<Campus> Campuss { get; set; }
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
恕我直言,如果'IdentityDbContext'從'DbContext'派生,第二個類可以合併到第一個。 –