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

            UsersDbContextConfigurer.Configure(builder, configuration.GetConnectionString(UsersConsts.ConnectionStringName));

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