views:

28

answers:

1

I would like to create an [CustomDataMember] attribute that override the formatter behavior of DataContractSerializer through an IOperationBehavior. I have followed the instructions given by Aaron Skonnard but when I call the DCS serializer, the custom behavior does not get neither instantiated nor called.

Obviously, I am missing something, probably at the level of the constructor call of DataContractSerializer. Does anyone knows what could be done to get the behavior properly injected in the DCS?

+1  A: 

Aaron's instructions don't apply. Those instructions are for switching which serializer WCF uses when dealing with message conversion. You're instantiating the serializer directly. DataContractSerializer doesn't really support much customization of the process- it's supposed to be dirt simple, not flexible. If you need flexibility, use XmlSerializer/IXmlSerializable.

nitzmahone
Just out of curiosity- did you flag this "community wiki" or did you make too many edits? You're likely to get better answers when people can get points for answering. :)
nitzmahone