public KuaiyipaiDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <KuaiyipaiDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true); KuaiyipaiDbContextConfigurer.Configure(builder, configuration.GetConnectionString(KuaiyipaiConsts.ConnectionStringName)); return(new KuaiyipaiDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <KuaiyipaiDbContext>(options => { if (options.ExistingConnection != null) { KuaiyipaiDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { KuaiyipaiDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } //Uncomment below line to write change logs for the entities below: //Configuration.EntityHistory.Selectors.Add("KuaiyipaiEntities", typeof(OrganizationUnit), typeof(Role), typeof(Tenant)); }