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

            AbpTrainingDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AbpTrainingConsts.ConnectionStringName));

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