public CruisePMSDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <CruisePMSDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true); CruisePMSDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CruisePMSConsts.ConnectionStringName)); return(new CruisePMSDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <CruisePMSDbContext>(options => { if (options.ExistingConnection != null) { CruisePMSDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { CruisePMSDbContextConfigurer.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("CruisePMSEntities", EntityHistoryHelper.TrackedTypes); // Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration)); }