WCF - サービス文書のカスタマイジング
質問
私はWCFプログラミングとそのシンジケーションクラスなどに慣れています。誰かが私のサービスのルートアドレスにアクセスしようとしているときにプログラムでAtompubサービス文書を作成しようとしています。私はServicedocument、ResourceCollectionInfo、Workspaceクラスを使用してある程度のみすることができます -
<service>
<app:workspace>
<a10:title type="text">Sample Repository</a10:title>
<app:collection href="http://some_url">
<a10:title type="text">Root Collection</a10:title>
</app:collection>
</app:workspace>
</service>
.
しかし、以下に見ることができるように、カスタム属性と要素を追加したいと思います。XMLNS属性、CMISRA要素などに注意してください。
.
<service
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<workspace>
<atom:title>Sample Repository</atom:title>
<collection href="http://some_url">
<atom:title>Root Collection</atom:title>
<cmisra:collectionType>root</cmisra:collectionType>
</collection>
</workspace>
</service>
MSDNのWebサイトや他の場所ではそれほど利用できません。これを達成する方法に関する入力はすべて理解されます。
ありがとう!
ありがとう。
解決
The ResourceCollectionInfo
class has two properties ElementExtensions
and AttributeExtensions
which can be used to customize the serialization of a ResourceCollectionInfo
. Please note that most of the syndication elements have those extensions, which work with both the RSS and Atom formatters.