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