An unofficial MemoryPack serializer integration for Microsoft Orleans.
Warning
This repository is maintained by the community under OrleansContrib. It is not an official Microsoft or Orleans project and is not supported or endorsed by the Orleans team.
MemoryPack operates on binary representations and should only be used with trusted input. Review its security properties for your application before using this integration. No patched upstream MemoryPack release is currently available for the concerns which prompted this project to move out of the Orleans repository.
The repository requires the .NET 10 SDK specified in global.json.
dotnet build Orleans.Serialization.MemoryPack.slnx --configuration Release
dotnet test Orleans.Serialization.MemoryPack.slnx --configuration Release --no-build
dotnet pack src/OrleansContrib.Serialization.MemoryPack/OrleansContrib.Serialization.MemoryPack.csproj --configuration Release --no-build --output artifactsThe package is written to artifacts/OrleansContrib.Serialization.MemoryPack.1.0.0.nupkg.
Reference the locally built package, then configure the serializer:
using Microsoft.Extensions.Hosting;
using Orleans.Serialization;
var builder = Host.CreateApplicationBuilder(args);
builder.UseOrleans(siloBuilder =>
{
siloBuilder
.UseLocalhostClustering()
.AddSerializer(serializerBuilder => serializerBuilder.AddMemoryPackSerializer());
});Types marked with [MemoryPackable] are handled automatically. Applications can also provide explicit type selectors:
serializerBuilder.AddMemoryPackSerializer(
isSerializable: type => type.Namespace?.StartsWith("MyApplication.Messages") is true,
isCopyable: type => type.Namespace?.StartsWith("MyApplication.Messages") is true);The library targets .NET 8, .NET 10, and .NET Standard 2.1. Package versions are managed in Directory.Packages.props.
This project is licensed under the MIT License.