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