using System.ComponentModel.DataAnnotations;
public class UserArmy
{
[Key, Column(Order = 1)]
public Guid UserId { get; set; }
[Key, Column(Order = 2)]
public int UnitId { get; set; }
public int Quantity { get; set; }
}
这是我的模特课。我正在使用实体框架,Code First方法。 [Key]属性被识别但不是Column(Order = x)。
我错过了需要包含的内容吗?
谢谢:)
答案 0 :(得分:4)
您必须添加以下命名空间:
using System.ComponentModel.DataAnnotations.Schema;
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.schema.aspx