Shuttle.Core.Serialization 21.0.0-alpha

Prefix Reserved
This is a prerelease version of Shuttle.Core.Serialization.
dotnet add package Shuttle.Core.Serialization --version 21.0.0-alpha
                    
NuGet\Install-Package Shuttle.Core.Serialization -Version 21.0.0-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Shuttle.Core.Serialization" Version="21.0.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shuttle.Core.Serialization" Version="21.0.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Shuttle.Core.Serialization" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Shuttle.Core.Serialization --version 21.0.0-alpha
                    
#r "nuget: Shuttle.Core.Serialization, 21.0.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Shuttle.Core.Serialization@21.0.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Shuttle.Core.Serialization&version=21.0.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Shuttle.Core.Serialization&version=21.0.0-alpha&prerelease
                    
Install as a Cake Tool

Shuttle.Core.Serialization

PM> Install-Package Shuttle.Core.Serialization

The following implementations of the ISerializer interface is used to serialize objects into a Stream:

  • XmlSerializer makes use of the standard .NET XML serialization functionality.
  • JsonSerializer makes use of the System.Test.Json serialization functionality.

Usage

XmlSerializer

services.AddXmlSerializer(builder => {
	builder.Options = new XmlSerializerOptions 
	{
	};

	// or

	buidler.Options.option = value;
});

The builder.Options contains properties that map to XmlWriterSettings as well as XmlDictionaryReaderQuotas.

JsonSerializer

services.AddJsonSerializer(builder => {
	builder.Options = new JsonSerializerOptions 
	{
	};

	// or

	buidler.Options.option = value;
});

The builder.Options is of type JsonSerializerOptions.

Methods

Serialize

Task<Stream> SerializeAsync(object message);

Returns the message object as a Stream.

Deserialize

Task<object> DeserializeAsync(Type type, Stream stream);

Deserializes the Stream into an object of the given type.

ISerializerRootType

The XmlSerializer implements the ISerializerRootType interface which is an optional interface that serializer implementations can use that allows the developer to specify explicit object types contained within a root type.

It is recommended that you explicitly register types with the same name, but in different namespaes, that will be serialized within the same root type to avoid any conflicts later down the line.

For instance, the following two types will cause issues when used in the root Complex type as they both serialize to the same name and the .Net serializer cannot seem to distinguish the difference:

namespace Serializer.v1
{
	public class MovedEvent
	{
		public string Where { get; set; } 
	}
}

namespace Serializer.v2
{
	public class MovedEvent
	{
		public string Where { get; set; } 
	}
}

namespace Serializer
{
	public class Complex
	{
		public v1.MovedEvent { get; set; }
		public v2.MovedEvent { get; set; }
	}
}

By explicitly specifying the types the XmlSerializer will add a namespace that will cause the types to be correctly identified.

AddSerializerType

void AddSerializerType(Type root, Type contained);

Specify the contained type that is used within the root type.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Shuttle.Core.Serialization:

Package Downloads
Shuttle.Esb

Contains the core Shuttle.Esb assembly that should always be referenced when building Shuttle.Esb solutions.

Shuttle.Recall

Event sourcing mechanism.

Shuttle.Core.Json

Json.Net implementation of the `ISerializer` interface.

Shuttle.Core.Mediator.OpenTelemetry

OpenTelemetry instrumentation for Shuttle.Core.Mediator implementations.

Shuttle.Hopper

Hopper is a flexible enterprise service bus which works with Azure Storage Queues, Amazon SQS, RabbitMQ, Kafka, and Event Hubs through a provider plugin API.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
21.0.0-alpha 36 1/18/2026
20.0.0 4,350 2/2/2025
11.0.0 7,142 4/30/2024
10.0.7 16,846 12/1/2022
10.0.6 893 9/4/2022
10.0.5 76,338 11/27/2020
10.0.4 72,365 10/15/2018
10.0.3 40,808 10/13/2018
10.0.2 24,880 7/3/2018
10.0.1 2,279 4/8/2018
10.0.0 23,631 1/2/2018