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