Serialization and MobileFormatter futures #2386
Replies: 1 comment 7 replies
-
From another thread @bradtwurst says:
One of the things @TheCakeMonster and I have been discussing over the past few weeks, is the idea of enhancing MF so it accepts a list of custom serializer types, where a serializer type knows how to serialize another type. A scenario where this would be useful is a type that knows how to serialize POCO types, so you'd register it with MF and it would "somehow" identify which types it is willing to serialize (maybe via a custom attribute on the type or whatever). Serializing arbitrary types is a potential security risk, which is why Microsoft has abandoned BinaryFormatter and NDCS. MF itself can only serialize types that opt-in to the process - you must code your type to participate in serialization, so the risk is not the same as BF/NDCS. I'd expect the same from any POCO serializer we build into the framework. However, this ability to implement a custom type serializer would allow you to implement whatever you'd like in your own codebase - assuming your own risk. You can imagine that a custom type serializer might implement an interface something like: public interface ISerializeType
{
bool CanSerialize(Type type);
void Serialize(SerializationIinfo info, object target);
object Deserialize(SerializationInfo info);
} That's off the type of my head, but is the gist of the idea. MF itself would, for types it doesn't already understand, loop through the registered type serializers asking each whether it knows how to serialize the current type. If the answer is yes, MF will delegate serialization/deserialization to the type serializer. If the answer is no, MF will keep checking and eventually (if no match is found) throw the same serialization exception it does today. |
Beta Was this translation helpful? Give feedback.
-
This is a thread for discussing possible futures around serialization and/or MobileFormatter as we look forward.
As this thread starts there are several related backlog items already listed, but this thread isn't limited by them.
Please keep in mind that CSLA 5 is "done" and all work is now occurring for CSLA 6 or later.
Beta Was this translation helpful? Give feedback.
All reactions