How to Specify Primary Key Name in EF-Code-First

后端 未结 5 646
眼角桃花
眼角桃花 2020-12-01 10:37

I\'m using Entity Framework Codefirst to create my Database. The default Primary key with the schema name dbo.pk_Jobs seems to upset access 2007 when I connect to it over OD

5条回答
  •  粉色の甜心
    2020-12-01 11:16

    You can use the Key attribute to specify the parts of the primary key. So your Job class might be

    public class Job
    {
        [Key]
        public Guid uuid{ get; set; }
        public int active{ get; set; }
    }
    

    The data annotation attributes are defined in the System.ComponentModel.DataAnnotations namespace

提交回复
热议问题