keenan
08-15-2008, 09:59 PM
In SimpleMessageConverter.cs, the ToMessage method checks for serialization ability using the following code:
else if (objectToConvert is ISerializable)
I have a class that is marked with the [Serializable] attribute, but it does not implement ISerializable so the above test is false. Is there any harm in changing the test to:
else if (objectToConvert.GetType().IsSerializable)
It would be necessary to overload or change the signature of CreateMessageForSerializable because in the above case we cannot cast the ISerializable, but the method is a one line wrapper around session.CreateObjectMessage() which takes in an object type, so I think it is feasible.
Looking further we would also have to change ExtractSerializableFromMessage as well because of the cast on message.Body to ISerializable.
Comments?
else if (objectToConvert is ISerializable)
I have a class that is marked with the [Serializable] attribute, but it does not implement ISerializable so the above test is false. Is there any harm in changing the test to:
else if (objectToConvert.GetType().IsSerializable)
It would be necessary to overload or change the signature of CreateMessageForSerializable because in the above case we cannot cast the ISerializable, but the method is a one line wrapper around session.CreateObjectMessage() which takes in an object type, so I think it is feasible.
Looking further we would also have to change ExtractSerializableFromMessage as well because of the cast on message.Body to ISerializable.
Comments?