Serialization¶
Suite framework leverage Newtonsoft.Json features for serializing objects. Serialization takes place mainly at:
- ASP.NET Core pipeline to deserialize incoming request (json) into proper DTO types.
- MassTransit when producing / consuming messages, since they must be sent over the wire and re-created in the other side.
Suite framework helps you by auto-discovering and registering your custom serializers properly for ASP.NET Core and MassTransit.
Custom serialization can be done through providing JsonConverter
implementations. Suite framework will auto-discover your JsonConverter
types,
and will pull them into the serializer configuration, either for ASP.NET Core or
MassTransit modules.
Important
Be aware of not using System.Text.Json
types or features, because the Suite
frameworks uses Newtonsoft.Json under the hood for serialization purposes.
ASP.NET Core serialization¶
Suite framework's Endpoints module configures ASP.NET Core pipeline to use
Newtonsoft.Json serializer. Endpoints module will auto-discover and register
your JsonConverter
types.
If you need to disable JsonSerializer
auto-discover feature, you have to tweak
EndpointsModuleOptions
as follows:
MassTransit serialization¶
Suite framework's MassTransit module auto-discovers your JsonConverter
types
and registers them into Newtonsoft.Json serializer.
If you need to disable JsonSerializer
auto-discover feature, you have to tweak
MassTransitModuleOptions
as follows:
C# | |
---|---|