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