title: exception error when I add [Required] to class
body: <p>I get an exception when I add <code>[Required]</code> to class:</p>
  
  <blockquote>
    <p>An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code.</p>
    
    <p>Additional information: The model backing the 'MovieDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database."</p>
  </blockquote>
  
  <p>The class</p>
  
  <pre><code>public class Movie
  {
      public int ID { get; set; }
  
      [StringLength(60, MinimumLength = 3)]
      [Required]
      public string Title { get; set; }
  
      [Display(Name = "Release Date"), DataType(DataType.Date)]
      [Range(typeof(DateTime), "1/1/1966", "1/1/2020")]
      public DateTime ReleaseDate { get; set; }
  
      [Required]
      [StringLength(30)]
      public string Genre { get; set; }
  
      [Range(1, 100),DataType(DataType.Currency)]
      public decimal Price { get; set; }
  
      [StringLength(5)]
      public string Rating { get; set; }
  }
  
  public class MovieDBContext : DbContext
  {
      public DbSet&lt;Movie&gt; Movies { get; set; }
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>namespace ICmovie.Controllers
  {
      public class MoviesController : Controller
      {
          private MovieDBContext db = new MovieDBContext();
  
          // GET: Movies
          public ActionResult Index(string movieGenre, string searchString)
          {
              var GenreLst = new List&lt;string&gt;();
  
              var GenreQry = from d in db.Movies
                             orderby d.Genre
                             select d.Genre;
  
              GenreLst.AddRange(GenreQry.Distinct());
              ViewBag.movieGenre = new SelectList(GenreLst);
  
              var movies = from m in db.Movies
                           select m;
  
              if (!String.IsNullOrEmpty(searchString))
              {
                  movies = movies.Where(s =&gt; s.Title.Contains(searchString));
              }
  
              if (!string.IsNullOrEmpty(movieGenre))
              {
                  movies = movies.Where(x =&gt; x.Genre == movieGenre);
              }
  
              return View(movies);
          }
  
          // GET: Movies/Details/5
          public ActionResult Details(int? id)
          {
              if (id == null)
              {
                  return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
              }
  
              Movie movie = db.Movies.Find(id);
  
              if (movie == null)
              {
                  return HttpNotFound();
              }
  
              return View(movie);
          }
  
          // GET: Movies/Create
          public ActionResult Create()
          {
              return View();
          }
  
          // POST: Movies/Create
          // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
          // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
          [HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult Create([Bind(Include = "ID,Title,ReleaseDate,Genre,Price,Rating")] Movie movie)
          {
              if (ModelState.IsValid)
              {
                  db.Movies.Add(movie);
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
  
              return View(movie);
          }
  
          // GET: Movies/Edit/5
          public ActionResult Edit(int? id)
          {
              if (id == null)
              {
                  return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
              }
  
              Movie movie = db.Movies.Find(id);
  
              if (movie == null)
              {
                  return HttpNotFound();
              }
  
              return View(movie);
          }
  
          // POST: Movies/Edit/5
          // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
          // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
          [HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult Edit([Bind(Include = "ID,Title,ReleaseDate,Genre,Price,Rating")] Movie movie)
          {
              if (ModelState.IsValid)
              {
                  db.Entry(movie).State = EntityState.Modified;
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
  
              return View(movie);
          }
  
          // GET: Movies/Delete/5
          public ActionResult Delete(FormCollection fcNotUsed, int id = 0)
          {
              Movie movie = db.Movies.Find(id);
  
              if (movie == null)
              {
                  return HttpNotFound();
              }
  
              db.Movies.Remove(movie);
              db.SaveChanges();
  
              return RedirectToAction("Index");
          }
  
          // POST: Movies/Delete/5
          [HttpPost, ActionName("Delete")]
          [ValidateAntiForgeryToken]
          public ActionResult DeleteConfirmed(int id)
          {
              Movie movie = db.Movies.Find(id);
              db.Movies.Remove(movie);
              db.SaveChanges();
              return RedirectToAction("Index");
          }
  
          protected override void Dispose(bool disposing)
          {
              if (disposing)
              {
                  db.Dispose();
              }
              base.Dispose(disposing);
          }
      }
  }
  </code></pre>