Exemplo n.º 1
0
        public Team5DbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <Team5DbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            Team5DbContextConfigurer.Configure(builder, configuration.GetConnectionString(Team5Consts.ConnectionStringName));

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