public HuyWebStoreDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <HuyWebStoreDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            HuyWebStoreDbContextConfigurer.Configure(builder, configuration.GetConnectionString(HuyWebStoreConsts.ConnectionStringName));

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