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