Soenneker.Cosmos.Serializer 11.0.2779

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Cosmos.Serializer --version 11.0.2779
                    
NuGet\Install-Package Soenneker.Cosmos.Serializer -Version 11.0.2779
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Cosmos.Serializer" Version="11.0.2779" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Cosmos.Serializer" Version="11.0.2779" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Cosmos.Serializer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Cosmos.Serializer --version 11.0.2779
                    
#r "nuget: Soenneker.Cosmos.Serializer, 11.0.2779"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Cosmos.Serializer@11.0.2779
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Cosmos.Serializer&version=11.0.2779
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Cosmos.Serializer&version=11.0.2779
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Cosmos.Serializer

An Azure Cosmos DB CosmosSerializer backed by System.Text.Json and pooled memory streams.

Installation

dotnet add package Soenneker.Cosmos.Serializer

Use with CosmosClient

using Soenneker.Cosmos.Serializer;
using Soenneker.Utils.MemoryStream.Abstract;
using Soenneker.Utils.MemoryStream.Registrars;

services.AddMemoryStreamUtilAsSingleton();

IMemoryStreamUtil memoryStreams =
    serviceProvider.GetRequiredService<IMemoryStreamUtil>();

var serializer = new CosmosSystemTextJsonSerializer(memoryStreams);

var client = new CosmosClient(
    endpoint,
    accountKey,
    new CosmosClientOptions
    {
        Serializer = serializer
    });

Soenneker.Cosmos.Client already constructs and installs this serializer, so applications using that client utility do not need to configure it again.

JSON behavior

Serialization uses Soenneker.Json.OptionsCollection.JsonOptionsCollection.WebOptions. The same options are used for reads and writes, keeping property naming and configured converters consistent. This replaces the Cosmos SDK's default serializer, so verify stored JSON compatibility before switching an existing container.

Stream ownership

ToStream returns a positioned stream owned by the Cosmos SDK or direct caller. The recipient must dispose it. If serialization fails before the stream is returned, the serializer disposes the pooled stream itself.

FromStream<T> consumes and disposes the supplied stream after deserialization. The exception is FromStream<Stream>, which returns the original stream without disposing it and transfers ownership to the caller. An empty MemoryStream deserializes to default(T).

Serialization and deserialization failures propagate to the caller. The adapter uses the synchronous CosmosSerializer contract, so it does not accept a cancellation token.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Cosmos.Serializer:

Package Downloads
Soenneker.Cosmos.Client

A utility library for Azure Cosmos client accessibility

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.2799 0 11/11/2026
11.0.2798 0 11/11/2026
11.0.2797 0 11/11/2026
11.0.2796 0 11/11/2026
11.0.2795 54 11/11/2026
11.0.2794 49 11/11/2026
11.0.2793 66 11/11/2026
11.0.2792 63 11/10/2026
11.0.2791 486 11/7/2026
11.0.2790 252 11/6/2026
11.0.2789 593 11/3/2026
11.0.2788 282 11/3/2026
11.0.2787 109 11/3/2026
11.0.2786 345 11/2/2026
11.0.2785 952 10/28/2026
11.0.2784 383 10/27/2026
11.0.2783 701 10/27/2026
11.0.2782 249 10/26/2026
11.0.2780 114 10/26/2026
11.0.2779 261 10/26/2026
Loading failed

Updated Soenneker.Json.OptionsCollection to 11.0.1316