Does Entity Framework 4 Code First have support for identity generators like NHibernate?

前端 未结 3 1338
暖寄归人
暖寄归人 2020-11-27 07:57

This question, asked a year ago, is similar: Does the Entity Framework 4 support generators for id values like NHibernate?

But what I\'d like to know is if the code

3条回答
  •  清酒与你
    2020-11-27 08:12

    [Key]
    public string Id { get; set; }
    

    and then use new GUID ToString

    Units.Add( new Unit(){Id=Guid.NewGuid().ToString(), Name="123"});
    

提交回复
热议问题