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

            ZhulinDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ZhulinConsts.ConnectionStringName));

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