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