WCF - Personalizzazione del documento di servizio
Domanda
Sono nuova per la programmazione WCF e le sue classi di sindacazione, ecc. Sto cercando di produrre un documento di servizio ATompub programmaticamente quando qualcuno cerca di accedere all'indirizzo root del mio servizio.Sono in grado di farlo solo in una certa misura utilizzando ServiceCument, ResourceCollectionINFO, Classi di lavoro -
<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>
.
Comunque vorrei aggiungere alcuni attributi ed elementi personalizzati come si può vedere di seguito.Si prega di notare gli attributi XMLNS, gli elementi CMISRA ecc.
.
<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>
Non c'è nulla di molto disponibile sul sito Web MSDN o altrove.Qualsiasi input su come raggiungere questo sarebbe apprezzato.
Grazie!
Grazie.
Soluzione
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.