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