public SamerCsDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <SamerCsDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); SamerCsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SamerCsConsts.ConnectionStringName)); return(new SamerCsDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <SamerCsDbContext>(options => { if (options.ExistingConnection != null) { SamerCsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { SamerCsDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }