Beispiel #1
0
        public CityInfoDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <CityInfoDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            CityInfoDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CityInfoConsts.ConnectionStringName));

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