????1.??Model?????棬д????????????
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Data.Entity;
6
7 namespace MvcMovie.Models
8 {
9     public class Movie
10     {
11         public int ID { get; set; }
12         public string Title { get; set; }
13         public DateTime ReleaseDate { get; set; }
14         public string Genre { get; set; }
15         public decimal Price { get; set; }
16     }
17
18     public class MovieDBContext : DbContext
19     {
20         public DbSet<Movie> Movies { get; set; }
21     }
22 }
????2.??????????У?д???
????1  <add name="MovieDBContext"
????2    connectionString="Data Source=(LocalDB)v11.0;AttachDbFilename=|DataDirectory|Movies.mdf;Integrated Security=True"
????3    providerName="System.Data.SqlClient"/>
????3.????????????????????????????Model???????????????????????

????4.??????????????????????????App_Data????????????????????Movie.mdf??.
????Entity Framework Code First detected that the database connection string that was provided pointed to a Moviesdatabase that didn’t exist yet?? so Code First created the database automatically. ??仰????????EF ???????м?????????????????????????????Movie??????????????????????????????code first?????????????????????