: 예를 들어
: 나는 위의 구성을 시도 할 때
//the complex type to return
class Entities
{
ICollection<Contract> Contracts;
...
}
//configuration
public partial class MyContext: DbContext
{
public MyContext()
: base("name=DBEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.ComplexType<Entities>();
modelBuilder.Entity<Contract>().HasKey(c=>c.Id);
...
}
...
}
//the WCF Data Service
public class PricingDataService : DataService<ObjectContext>, IDisposable
{
[WebGet]
public Entities GetEntities()
{
return new Entities();
}
}
, 나는 예외를 얻을 탐색 속성을 계약에 적용합니다. 이것은 전체 엔티티 프레임 워크에서 허용되지 않습니다. 이 오류는 아마도 Contract
이 엔티티로 정의되었지만 complext 유형이이를 다른 것으로 매핑하려고 시도하는 것으로부터 비롯된 것으로 추측 할 수 있습니다.하지만 이는 단지 추측에 불과합니다.
이것을 시도하면 어떻게됩니까? –
예외가 발생했습니다. "모델 생성 중에 하나 이상의 유효성 검사 오류가 발견되었습니다. System.Data.Edm.EdmEntityType : Name : 스키마의 각 형식 이름이 고유해야하며 형식 이름 'Contract'가 이미 있어야합니다. 한정된." – Attilah
이렇게하면 복잡한 유형을 반환하는 것과 아무런 관련이없는 것 같습니다. 모델에 문제가 있습니다. –