public SchoolManagementSystemDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <SchoolManagementSystemDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); SchoolManagementSystemDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SchoolManagementSystemConsts.ConnectionStringName)); return(new SchoolManagementSystemDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <SchoolManagementSystemDbContext>(options => { if (options.ExistingConnection != null) { SchoolManagementSystemDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { SchoolManagementSystemDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }