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