You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we will not be supporting static SerialzationManager.Register(...) method, we need to change the signature of the method used to register custom serializers so that it takes some kind of context (eg, ISerializerRegistrar) so that serializers can be registered.
In a local branch, I've made the following changes:
[Serializer(typeof(TargetType))] automatically registers the type it's attached to as the serializer for TargetType. This includes when TargetType is an open generic.
Generated serializers no longer have Register methods or the associated attribute.
No additional class is generated for generic types since the Register method is no longer needed. i.e, no "master registerer" class.
The Register method in types marked with [RegisterSerializer] must accept a parameter of type ISerializerRegistrar.
So [RegisterSerializer] is rarely required. The one place it's required in our codebase is for the tests which register the same serializer for multiple different JSON types (JObject, JArray, etc) but that could just as easily be accomplished using an IExternalSerializer implementation. We could even remove [RegisterSerializer] altogether, but I'm not suggesting that yet.
Since we will not be supporting static
SerialzationManager.Register(...)
method, we need to change the signature of the method used to register custom serializers so that it takes some kind of context (eg,ISerializerRegistrar
) so that serializers can be registered.In a local branch, I've made the following changes:
[Serializer(typeof(TargetType))]
automatically registers the type it's attached to as the serializer forTargetType
. This includes whenTargetType
is an open generic.Register
methods or the associated attribute.Register
method in types marked with[RegisterSerializer]
must accept a parameter of typeISerializerRegistrar
.So
[RegisterSerializer]
is rarely required. The one place it's required in our codebase is for the tests which register the same serializer for multiple different JSON types (JObject
,JArray
, etc) but that could just as easily be accomplished using anIExternalSerializer
implementation. We could even remove[RegisterSerializer]
altogether, but I'm not suggesting that yet.Does this all sound fine?
Related to #467
EDIT: oh, and the
[RegisterSerializer]
change is a good candidate for something to add to a code analyzerThe text was updated successfully, but these errors were encountered: