I would like to have all strings in inbound WCF messages trimmed, so that I don't have to worry about trimming them in all of my operations. I can accomplish this with an IParameterInspector
and a lot of delicate reflection logic, but it seems like there must be a better way.
I have tried using an IDataContractSurrogate
, but the GetDeserializedObject
does not get called for string deserialization.
Is there another way to hook into DataContractSerializer that would let me modify strings without massive reflection?