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