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