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