プロジェクト:内部でEF4 CTP5コードファーストアプローチを使用するWCFデータサービス。WCFデータサービス(OData)、継承制限のあるクエリ?
私は、継承(TPH)でエンティティを設定しました。マッピングがうまく機能
Previous question about multiple entities- same table
、およびEF4以上のユニットテストは、クエリがスムーズに実行することを確認: このトピックの前の質問を参照してください。
私のエンティティは次のようになります。
- ContactBase(抽象)
- お客様(ContactBaseから継承)、このエンティティが他のエンティティに向けても、いくつかのナビゲーション特性を有している
- リソース(ContactBaseから継承)
私はディスクリミネータを設定しているので、CustomerとResourceの両方が同じテーブルにマップされています。 は再び、何もかもが(単位はすべての野菜をテスト!)ビューの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)と継承仕様については、Web上ではほとんどドキュメントが見つかりません。
どうすればこの例外を上回ることができますか?派生したエンティティでこれらのナビゲーションプロパティが必要です。継承は同じテーブルの2つのエントリをEf4 CTP5でマッピングする唯一の方法です...
OData確かに吸う。しかし、将来的にはより良いものになるかもしれない。悪い経験がそれと一緒に働いている2013. –