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