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