Monday, March 26, 2012 1:19 PM
I am moving on with my attempt to implement MongoDB OData provider, and my next stop is serialization of properties that have CLR counterparts but are represented differently. One such property type is DateTime. MongoDB has its own DateTime type, and if I try to map MongoBD DateTime to CLR DateTime, then provider throws an exception saying that it is unable to serialize a primitive value. The exception is thrown from PlainXmlSerializer.PrimitiveToString() method. I checked the implementation and it looks that it's possible to override default behavior by providing custom DictionarySerializerDelegate. The problem is that it's internal functionality not to be used outside WCF Data Services classes.
So I wonder if this is possible at all using WCF Data Service to implement custom OData provider. A workaround is to map non-standard primitive data to strings, but this is kind of dirty (and killes search possibilities for such properties).
Thanks in advanceUPDATE. I think I've solved it. Of course I get a chance to override the value when I wrap native data into a DSPResource instance. No need to intervene with DictionarySerializerDelegate.
Tuesday, March 27, 2012 8:16 AMModerator