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

            ProductManagerDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ProductManagerConsts.ConnectionStringName));

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