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