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

            AbpLearningDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AbpLearningConsts.ConnectionStringName));

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