title: Asp.net Seeding db Entity Framework is not working
body: <p>I want to seed the database with default data but I get an exception thrown.</p>
  
  <p>I added this initialize class in the DAL namespace</p>
  
  <pre><code>public class MyModelInitialise : DropCreateDatabaseIfModelChanges&lt;MyModelContext&gt;
  
  {
  
      protected override void Seed(MyModelContext context)
  
      {
  
          base.Seed(context);
  
  
  
          var MyMarks = new List&lt;MyMark&gt;
  
          {
  
           new Mark{ Name="Mark1", Value="250"},
  
           new Mark{ Name="Mark2", Value="350"},
  
           new Mark{ Name="Mark3", Value="450"}
  
          };
  
          Marks.ForEach(bm =&gt; context.Marks.Add(bm));
  
  
  
          context.SaveChanges();
  
      }
  
  }
  </code></pre>
  
  <p>I added this initialiser to app startup</p>
  
  <pre><code>protected void Application_Start()
  
     {
  
          Database.SetInitializer&lt;MyModelContext&gt;(new MyModelInitialise());
  
     }
  </code></pre>
  
  <p>I get the following error while invoking this</p>
  
  <pre><code>Model compatibility cannot be checked because the DbContext instance was not created
  using Code First patterns. DbContext instances created from an ObjectContext or using 
  an EDMX file cannot be checked for compatibility.
  </code></pre>