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

            ShopperCartDbContextConfigurer.Configure(builder,
                                                     configuration.GetConnectionString(ShopperCartConsts.ConnectionStringName));

            return(new ShopperCartDbContext(builder.Options));
        }
Exemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <ShopperCartDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 ShopperCartDbContextConfigurer.Configure(options.DbContextOptions,
                                                          options.ExistingConnection);
             }
             else
             {
                 ShopperCartDbContextConfigurer.Configure(options.DbContextOptions,
                                                          options.ConnectionString);
             }
         });
     }
 }