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