3
를 사용스토어 ValueObject는 ASP.NET 상용구 및 엔티티 프레임 워크를 사용하여 DDD을 구현하기 위해 노력하는 ASP.NET 상용구
Employee
객체
public class Employee : Entity<long>
{
public virtual string Name { get; protected set; }
public virtual Nationality Nationality { get; protected set; }
}
는 정의 값 객체를
public class Nationality : ValueObject<Nationality>
{
public virtual string Name { get; protected set; }
}
이다 재산
Nationality
,
데이터베이스 마이그레이션을 추가하면 명백한 오류가 발생합니다.
EntityType 'Nationality' has no key defined. Define the key for this EntityType.
수동 (모범 사례 중 일부는 무엇인가 그렇다면) ValueObject
을 유지하기 위해 내가 위에서 언급 한 방법 중 하나를 구현해야 3 different approach to persist value object in database
를 살펴 툭? 또는 이미 완료되었습니다 by ASP.NET Boilerplate Framework?
'ValueObject'은 무엇입니까? 오류는 상속과 관련이 있다고 생각합니다. '국적'은 가치 객체 (EF 용어로 'ComplexType')로 해석되어야합니다. –
@GertArnold [ASP.NET Boilerplate Framework defined type] (http://www.aspnetboilerplate.com/Pages/Documents/Value-Objects) – tchelidze
@GertArnold 물론, EF 버전 6.1.3을 사용하고 있습니다. – tchelidze