【发布时间】:2011-04-15 14:08:48
【问题描述】:
我有一个简单的课程:
public class Member
{
public int AccountId { get; set; }
public string Name { get; set; }
public string Role { get; set; }
public DateTime MemberSince { get; set; }
}
我需要将 AccountId 设为键,但如果我使用“Key”属性,它会将其转换为对我不起作用的身份(此数据来自其他来源,因此无法更改值)。
还有其他方法吗?
有almost the exact same question here 除了答案使用我做不到的流畅界面。
【问题讨论】:
标签: entity-framework mapping data-annotations entity-framework-4.1