update-database command does not work in multiple contexts

1

I have two context in my project.

I followed the instructions in this Article where it shows how to have 2 context in the same project.

Each context is for separate banks, so they are 2 ConnectionString

However when using the command update-database nothing happens, the syntax used is the same as mentioned in the article:

Update-Database -configuration NameSpace.Configuration -Force -Verbose

In the file of Configuration in both migrations contains this configuration:

        AutomaticMigrationsEnabled = true;
        MigrationsDirectory = @"AppMigrations";

I added one more property in my class , though it does not generate the column in the database.

I'm using Code First

[Edit] The code for each context is:

Context 1

  public class MyDbContext : IdentityDbContext<Usuario, Role, int, UsuarioLogin, UsuarioRole, UsuarioClaim>
  {
    public MyDbContext()
      : base("MyConnection")
    {
      Database.SetInitializer<MyDbContext>(new AppDbInitializer());
    }
    #region DbSets
    public DbSet<Empresa> Empresas { get; set; }
    #endregion

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
      base.OnModelCreating(modelBuilder);

      modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
      modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();

      modelBuilder.Properties<DateTime>()
      .Configure(x => x.HasColumnType("datetime2"));
    }
    public static MyDbContext Create()
    {
      return new MyDbContext();
    }
  }

My Context 2:

 public class GlobalDbContext : DbContext
  {
    public GlobalDbContext()
      : base("GlobalConnection")
    {
      Database.CreateIfNotExists();
    }
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
      Database.SetInitializer<GlobalDbContext>(null);
      modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
      modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();

      modelBuilder.Properties<DateTime>()
      .Configure(x => x.HasColumnType("datetime2"));
      base.OnModelCreating(modelBuilder);
    }
    public DbSet<CBO> CBOs { get; set; }
  }

Reason to use 2 context:

A database (represented by context 1) is for each client The global context, are tables that will be used on all clients, thus a global database with simple information not to be repeated in all banks

    
asked by anonymous 20.05.2015 / 19:50

0 answers