Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ siloBuilder.Services.AddSerializer(serializerBuilder =>
});
```

## Configure Orleans to use Google Protocol Buffers

To configure Orleans to use Google Protocol Buffers (Protobuf) to serialize your types, reference the [Microsoft.Orleans.Serialization.Protobuf](https://nuget.org/packages/Microsoft.Orleans.Serialization.Protobuf) NuGet package. Then, configure the serializer, specifying which types it will be responsible for. In the following example, we specify that the Protobuf serializer is responsible for all types in the `Example.Namespace` namespace.

- Install the [Microsoft.Orleans.Serialization.Protobuf](https://nuget.org/packages/Microsoft.Orleans.Serialization.Protobuf) NuGet package.
- Configure the serializer using the <xref:Orleans.Serialization.SerializationHostingExtensions.AddProtobufSerializer%2A> method.

Consider the following example when interacting with the <xref:Orleans.Hosting.ISiloBuilder>:

```csharp
siloBuilder.Services.AddSerializer(serializerBuilder =>
{
serializerBuilder.AddProtobufSerializer(
isSupported: type => type.Namespace.StartsWith("Example.Namespace"));
});
```

:::zone-end

<!-- markdownlint-disable MD044 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ One important aspect of Orleans is its support for customization of serializatio
:::zone target="docs" pivot="orleans-7-0"
<!-- markdownlint-enable MD044 -->

Orleans provides two serializer implementations:
Orleans provides three serializer implementations:

- [Microsoft.Orleans.Serialization.SystemTextJson](https://nuget.org/packages/Microsoft.Orleans.Serialization.SystemTextJson)
- [Microsoft.Orleans.Serialization.NewtonsoftJson](https://nuget.org/packages/Microsoft.Orleans.Serialization.NewtonsoftJson)
- [Microsoft.Orleans.Serialization.Protobuf](https://nuget.org/packages/Microsoft.Orleans.Serialization.Protobuf)

To configure either of these packages, see [Serialization configuration in Orleans](serialization-configuration.md?pivots=orleans-7-0).

Expand Down
Loading