Skip to content

OrleansContrib/Orleans.Serialization.MemoryPack

Repository files navigation

Orleans Serialization for MemoryPack

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.

Build a package

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 artifacts

The package is written to artifacts/OrleansContrib.Serialization.MemoryPack.1.0.0.nupkg.

Configure Orleans

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);

Compatibility

The library targets .NET 8, .NET 10, and .NET Standard 2.1. Package versions are managed in Directory.Packages.props.

License

This project is licensed under the MIT License.

About

Unofficial MemoryPack serialization integration for Microsoft Orleans

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages