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

            DairyDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DairyConsts.ConnectionStringName));

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