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