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