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