Ejemplo n.º 1
0
        public BrandChallengeDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <BrandChallengeDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            BrandChallengeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(BrandChallengeConsts.ConnectionStringName));

            return(new BrandChallengeDbContext(builder.Options));
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <BrandChallengeDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 BrandChallengeDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 BrandChallengeDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }