diff --git a/Changelog.md b/Changelog.md index 2dfa73684..e0d5ee8e1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,55 @@ +# 5.10.0 / AspNetCore 1.6.0 — MessagePack transport preview + +## AspNetCore 1.6.0 + +* Added MessagePack wire-format support (`application/vnd.msgpack`) via [#591](https://github.com/OpenRIAServices/OpenRiaServices/pull/591) + +### Enable MessagePack on the server + +```csharp +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddOpenRiaServices() + .AddMessagePackSerialization(); +``` + +Optionally pass a custom `Nerdbank.MessagePack.MessagePackSerializer` to add converters or a custom comparer provider: + +```csharp +builder.Services.AddOpenRiaServices() + .AddMessagePackSerialization(opt => + { + opt.Serializer = new Nerdbank.MessagePack.MessagePackSerializer() + { + // custom converters / comparer provider + }; + }); +``` + +## Client (`OpenRiaServices.Client.DomainClients.Http`) + +* Added `MessagePackHttpDomainClientFactory` — a `DomainClientFactory` that communicates with the server using MessagePack over HTTP + +### Enable MessagePack on the client + +```csharp +DomainContext.DomainClientFactory = + new MessagePackHttpDomainClientFactory(baseUri, httpClientFactory); +``` + +Optionally pass a custom serializer: + +```csharp +var serializer = new MessagePackSerializer() +{ + // custom converters / comparer provider +}; + +DomainContext.DomainClientFactory = + new MessagePackHttpDomainClientFactory(baseUri, httpClientFactory, serializer); +``` + +For performance benchmark data see [PR #591](https://github.com/OpenRIAServices/OpenRiaServices/pull/591). + # AspNetCore 1.5.0 * Allow configuring Serializer security settings diff --git a/src/OpenRiaServices.Hosting.AspNetCore/Framework/README.md b/src/OpenRiaServices.Hosting.AspNetCore/Framework/README.md index c08eff4a9..a5dbda467 100644 --- a/src/OpenRiaServices.Hosting.AspNetCore/Framework/README.md +++ b/src/OpenRiaServices.Hosting.AspNetCore/Framework/README.md @@ -142,6 +142,26 @@ builder.Services.AddOpenRiaServices() .AddMessagePackSerialization(); ``` +#### Known limitations + +The following types are **not** supported out of the box and require custom `MessagePackConverter` implementations registered via `MessagePackSerializationOptions.Serializer.Converters`: + +- **`System.Xml.Linq.XElement`** — not handled by the default serializer. See the [XElementConverter sample](https://github.com/OpenRIAServices/OpenRiaServices/blob/main/src/Test/AspNetCoreWebsite/MessagePack/XElementConverter.cs) for a reference implementation that serialises the element as a plain XML string. +- **`System.Data.Linq.Binary`** — not handled by the default serializer. See the [BinaryConverter sample](https://github.com/OpenRIAServices/OpenRiaServices/blob/main/src/Test/AspNetCoreWebsite/MessagePack/BinaryConverter.cs) for a reference implementation. + +Register the converters by passing a configuration callback: + +```csharp +builder.Services.AddOpenRiaServices() + .AddMessagePackSerialization(opt => + { + opt.Serializer = new Nerdbank.MessagePack.MessagePackSerializer() + { + Converters = [new XElementConverter(), new BinaryConverter()], + }; + }); +``` + ### Configuring serializer security quotas You can configure reader quotas to limit resource consumption and mitigate denial-of-service (DoS) attacks.