프로젝트 : 내부적으로 EF4 CTP5 코드 우선 접근 방식을 사용하는 WCF 데이터 서비스.WCF 데이터 서비스 (OData), 상속 제한 쿼리?
상속 (TPH)으로 엔티티를 구성했습니다.
Previous question about multiple entities- same table
매핑이 잘 작동하고, EF4 이상 단위 테스트 쿼리가 원활하게 실행되는지 확인 : 이 주제에 대한 이전 질문을 참조하십시오.
내 실체는 다음과 같습니다
- ContactBase (추상)
- 고객 (ContactBase에서 상속),이 엔티티는 다른 엔티티 방향으로도 여러 가지 탐색 속성이 있습니다
- 자원 (ContactBase에서 상속)
저는 식별자를 구성 했으므로 고객과 리소스가 동일한 테이블에 매핑됩니다. 가 다시 everythings가 (단위는 모두 그린을 테스트!)보기의 EF4 점에서 잘 작동
그러나, WCF 데이터 서비스를 통해이 DBContext을 노출 할 때, 내가 얻을 : - 숨겨진 보인다 (고객 및 자원 세트 노출 CustomerBases 세트, ?
Navigation Properties are not supported on derived entity types. Entity Set 'ContactBases' has a instance of type 'CodeFirstNamespace.Customer', which is an derived entity type and has navigation properties. Please remove all the navigation properties from type 'CodeFirstNamespace.Customer'.
스택 트레이스 :
at System.Data.Services.Serializers.SyndicationSerializer.WriteObjectProperties(IExpandedResult expanded, Object customObject, ResourceType resourceType, Uri absoluteUri, String relativeUri, SyndicationItem item, DictionaryContent content, EpmSourcePathSegment currentSourceRoot)
at System.Data.Services.Serializers.SyndicationSerializer.WriteEntryElement(IExpandedResult expanded, Object element, ResourceType expectedType, Uri absoluteUri, String relativeUri, SyndicationItem target)
at System.Data.Services.Serializers.SyndicationSerializer.<DeferredFeedItems>d__b.MoveNext()
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteItems(XmlWriter writer, IEnumerable`1 items, Uri feedBaseUri)
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeedTo(XmlWriter writer, SyndicationFeed feed, Boolean isSourceFeed)
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteFeed(XmlWriter writer)
at System.ServiceModel.Syndication.Atom10FeedFormatter.WriteTo(XmlWriter writer)
at System.Data.Services.Serializers.SyndicationSerializer.WriteTopLevelElements(IExpandedResult expanded, IEnumerator elements, Boolean hasMoved)
at System.Data.Services.Serializers.Serializer.WriteRequest(IEnumerator queryResults, Boolean hasMoved)
at System.Data.Services.ResponseBodyWriter.Write(Stream stream)
는 WCF 데이터 SERVI의 제한 것 같다 -이 디자인입니다) 나는 고객에 하나로, OData를 통해 조회 할 때, 나는이 오류 ces ... 그것입니까? 웹에서 WCF 데이터 서비스 (OData) 및 상속 사양에 대한 설명서가 많지 않습니다.
이 예외를 어떻게 초과 할 수 있습니까? 파생 된 엔터티에 이러한 탐색 속성이 필요하며 상속은 Ef4 CTP5와 동일한 테이블에 2 개의 entites 매핑을 제공하는 유일한 방법 인 것 같습니다 ...
모든 의견?
OData 확실히 빠릅니다. 그러나 미래에는 더 나아질 수 있습니다. 나쁜 경험 년 2013 년 함께 일하고. –