Aim
To dynamically expose an RSS/Atom endpoint for a service that has an unknown enumerable type. The type will be found via reflection to build the syndication endpoint(s).
Approach
I am using .net 4.0
I am reflecting over a dll to expose endpoints, ie json, xml, soap. That all works as I want it to. (I am thus, using code to configure my WCF setup).
I am now trying to expose an rss endpoint for all ICollection found via reflection exposed via my services so that I can expose a SyndicationFeed for each method returning an ICollection.
I believe that I want to use a datascontractsurrogate, and have followed what msdn has to add on this. I have hooked up my datacontractsurrogate and I have observed that it is hitting my debug points inside of the surrogate.
I am getting the following exception from the svclog viewer:
Exception Type:
System.Runtime.Serialization.InvalidDataContractException, System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message:
Using surrogates with get-only collection properties is not supported. Consider removing the surrogate associated with 'System.Collections.Generic.Dictionary`2[[System.Xml.XmlQualifiedName, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
Questions
- Conceptually what are my options for achieving what I want to acheive?
- Can I keep a type safe way of outputting a SyndicationFeed type rather than opting to write adhoc to an xml string?