开发者

wcf - customizing service document

I am new to WCF programming and its syndication classes etc. I am trying to produce a AtomPub service document programmatically when someone tries to access root address of my service. I am able to do that only to some extent using ServiceDocument, ResourceCollectionInfo, Workspace classes -

<service>
<app:wor开发者_StackOverflowkspace>
    <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>

However I would like to add some custom attributes and elements as can be seen below. Please notice the xmlns attributes, cmisra elements etc.

<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>

There is nothing much available on msdn website or elsewhere. Any inputs on how to achieve this would be appreciated.

Thanks!

Thanks.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜