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