나는 다음과 같은 모델을 가지고, 그들은 괜찮 았는데 :Entity Framework 4.3.1 -> 5.0 예외 : "EntityType에 정의 된 키가 없습니다.이 EntityType의 키를 정의하십시오." 엔티티 프레임 워크 4.3.1에서
public class BaseUser
{
[Key]
[MaxLength(100)]
public string Username { get; set; }
}
[Table("AppUser")] // Ensures EF Code First uses Table-per-Type
public class AppUser : BaseUser
{
[MaxLength(200)]
public string About { get; set; }
}
나는이 응용 프로그램을 실행하고 관련 DbContext에 액세스하려고 할 때, 나는 예외를 다음 얻을 EF 5.0로 업그레이드 한 후 :
EntityType 'AppUser' has no key defined. Define the key for this EntityType.
어떻게이 문제를 해결할 수 있습니까? 이것은 회귀 것으로 보인다.