ASP.NET MVC5????EF??????????????????
???????????? ???????[ 2015/6/23 14:04:40 ] ?????????????
????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?????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11