title: Entity Framework with multiple models throws error stating "The model backing the <modelDbContext> context has changed..."
body: <p>I have two separate unrelated models that I am trying to use in the same database. Here is the code for each:</p>
  
  <pre><code>public class ImageDBContext : DbContext
  {
      public ImageDBContext()
          : base("DefaultConnection")
      {
      }
  
      public DbSet&lt;ImageModel&gt; Images { get; set; }
  
  }
  
  [Table("Images")]
  public class ImageModel
  {
      [Key]
      public int ID { get; set; }
      public string Type { get; set; }
      public string Title { get; set; }
      public string Description { get; set; }
      public string FileName { get; set; }
  
      [NotMapped]
      public HttpPostedFileBase Attachment { get; set; }
  }
  </code></pre>
  
  <p>Here is the other model</p>
  
  <pre><code>public class TestimonialDBContext : DbContext
  {
      public TestimonialDBContext()
          : base("DefaultConnection")
      {
      }
  
      public DbSet&lt;Testimonial&gt; Testimonials { get; set; }
  }
  
  [Table("Testimonials")]
  public class Testimonial
  {
      [Key]
      public int Id { get; set; }
      public string Name { get; set; }
      public string Description { get; set; }
  }
  </code></pre>
  
  <p>When I access the view for one model it works great. It doesn't matter which model but when I go to the view for the other model I get this error:</p>
  
  <p>The model backing the 'ImageDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database (<a href="http://go.microsoft.com/fwlink/?LinkId=238269" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=238269</a>).</p>
  
  <p>It seems to me like both models are trying to use the same table? The table gets created by the first model that is initialized but then the second model tries to use the the existing table instead of creating its own.</p>
  
  <p>How can I get both models to use their own tables in the database?</p>
  
  <p>Here is the connection string:</p>
  
  <pre><code> &lt;add name="DefaultConnection" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=--------;User ID=-------;Password=---------" providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p>Update: I have added the following code to the models and I still get the same error.</p>
  
  <pre><code>    protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;ImageModel&gt;().ToTable("ImagesTable");
      }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;Testimonial&gt;().ToTable("TestimonialsTable");
      }
  </code></pre>