Skip to main content
net10.0net8.0.NETStandard2.1

Google.Protobuf integration for Orleans.Serialization

Published
Oct 3, 2026
16d ago
Total Downloads
522.5K
522,506

Install

dotnet add package Microsoft.Orleans.Serialization.Protobuf --version 10.4.0
ProductVersions
.NET
net10.0net8.0
.NET Standard
netstandard2.1

README

Microsoft Orleans Serialization for Protobuf

Introduction

Microsoft Orleans Serialization for Protobuf provides Protocol Buffers (Protobuf) serialization support for Microsoft Orleans using Google.Protobuf. This package integrates Google's official Google.Protobuf library with Orleans, allowing you to use Protocol Buffers messages in your grain interfaces and implementations.

Getting Started

To use this package, install it via NuGet:

dotnet add package Microsoft.Orleans.Serialization.Protobuf

Example - Configuring Protobuf Serialization

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Orleans.Hosting;
using Orleans.Serialization;

var builder = Host.CreateApplicationBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder
            .UseLocalhostClustering()
            // Configure Protobuf as a serializer
            .AddSerializer(serializerBuilder => serializerBuilder.AddProtobufSerializer());
    });

// Run the host
await builder.RunAsync();

Using Protobuf Types with Orleans

This package supports types generated from .proto files using Google.Protobuf. For detailed information on creating Protobuf messages and configuring your project, see Create Protobuf messages for .NET apps.

Once you have defined your Protobuf messages and configured code generation, you can use them directly in your grain interfaces:

using Orleans;
using MyApp.Models;

public interface IMyGrain : IGrainWithStringKey
{
    Task<MyProtobufClass> GetData();
    Task SetData(MyProtobufClass data);
}

public class MyGrain : Grain, IMyGrain
{
    private MyProtobufClass _data;

    public Task<MyProtobufClass> GetData() => Task.FromResult(_data);
    public Task SetData(MyProtobufClass data)
    {
        _data = data;
        return Task.CompletedTask;
    }
}

Note: Google.Protobuf collection types (RepeatedField<T>, MapField<TKey, TValue>, and ByteString) are automatically supported.

Documentation

For more comprehensive documentation, please refer to:

Feedback & Contributing

Changes from Previous Version

No structural changes between v10.3.1 and v10.4.0.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.The published metadata declares 35 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.