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

            WebShopDbContextConfigurer.Configure(builder, configuration.GetConnectionString(WebShopConsts.ConnectionStringName));

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