Пример #1
0
        public AdminDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <AdminDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            AdminDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AdminConsts.ConnectionStringName));

            return(new AdminDbContext(builder.Options));
        }
Пример #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <AdminDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 AdminDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 AdminDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }