Asp.net MVC????MySQL?????
???????????? ???????[ 2015/8/18 13:54:48 ] ????????????? ???????????
?????.MySQL Connector/Net
???????????????MySQL??????????? MySQL Connector/Net
????????????????????????????а????MySQL?????????MySQL Connector/Net
??????????? ?? http://dev.mysql.com/downloads/connector/net/
?????????: ??? MySQL Connector/Net ??????? mysql-connector-net-6.8.3.msi??
??????.????????????????MySQL
?????????п???????????
??????.???????????
???????????????Mvc???
?????????:??????Nuget????? ????:MySql.Data && MySql.Data.Entity ??????
????????????????????????(?????SqlServer???????????????????????“wahaha”)
????1 <!--????MySql????????????????charset=utf8???????MySql?б????????????????????????-->
????2 <add name="DefaultConnection" connectionString="server=127.0.0.1;user id=root;password=????;persist security info=True;database=?????????;charset=utf8;" providerName="MySql.Data.MySqlClient" />
??????.???????
1 public class Person
2 {
3 [Key]
4 public int pid { get; set; }
5 [Required]
6 [StringLength(50)]
7 [Display(Name ="????")]
8 public string pname { get; set; }
9 [StringLength(50)]
10 [Display(Name = "????")]
11 public string pbirthday { get; set; }
12 }
??????.????????????
1 [DbConfigurationType(typeof(MySqlEFConfiguration))]
2 public class MyContext:DbContext
3 {
4 public DbSet<Person> Person { get; set; }
5
6 public MyContext()
7 : base("DefaultConnection")
8 {
9 Database.CreateIfNotExists();
10 }
11 }
??????.?????????????????????
???????????????????MySql???????????
??????
???·???
??????????????????
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