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