MVC Model与数据库表对应方式
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations; namespace EF43.UpdateSchema { [Table("Product")] public class Product { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ProductId { get; set; } [Required] [Column("ProductName", TypeName="varchar")] public string Name { get; set; } } }
参考文章:http://www.cnblogs.com/webabcd/archive/2012/05/30/2525047.html