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