public DcsDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <DcsDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); DcsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SdtConsts.DcsConnectionStringName)); return(new DcsDbContext(builder.Options)); }
public override void PreInitialize() { if (SkipDbContextRegistration) { return; } Configuration.Modules.AbpEfCore().AddDbContext <DcsDbContext>(options => { if (options.ExistingConnection != null) { DcsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { var configurationAccessor = IocManager.Resolve <IAppConfigurationAccessor>(); var connectionString = configurationAccessor.Configuration["ConnectionStrings:DcsEntity"]; DcsDbContextConfigurer.Configure(options.DbContextOptions, connectionString); } }); }