WCF - Personalización del documento de servicio
Pregunta
Soy nuevo en la programación de WCF y sus clases de sindicación, etc. Estoy tratando de producir un documento de servicio ATOMPUPUP programáticamente cuando alguien intenta acceder a la dirección raíz de mi servicio.Soy capaz de hacerlo solo hasta cierto punto utilizando Servicedocument, ResourceCollectionInfo, clases de espacio de trabajo -
<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>
Sin embargo, me gustaría agregar algunos atributos y elementos que se pueden ver a continuación.Tenga en cuenta los atributos XMLNS, los elementos CMISRA, 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>
No hay nada disponible en el sitio web de MSDN o en otro lugar.Cualquier entrada sobre cómo lograr esto sería apreciada.
¡Gracias!
gracias.
Solución
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.