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