Mapping Columns in Entity Framework Code First

后端 未结 2 938
鱼传尺愫
鱼传尺愫 2021-02-01 14:17

I\'m having trouble trying to map my EF 4.1 Code First model to a database. Everything works fine when the database match the code exactly, but when I try and map when the colum

2条回答
  •  悲&欢浪女
    2021-02-01 14:51

    How about using DataAnnotations?

    [Key]
    [Column("ColID", TypeName="int")]
    public int DinnerID { get; set; }  
    

    You can find a full list with samples at http://msdn.microsoft.com/en-us/data/gg193958

提交回复
热议问题