Show / Hide Table of Contents

Class SystemTextJsonCosmosSerializer

Source: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos.Samples/Usage/SystemTextJson/CosmosSystemTextJsonSerializer.cs

Inheritance
object
CosmosSerializer
CosmosLinqSerializer
SystemTextJsonCosmosSerializer
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Benday.CosmosDb.Utilities
Assembly: Benday.CosmosDb.dll
Syntax
public class SystemTextJsonCosmosSerializer : CosmosLinqSerializer

Constructors

| Edit this page View Source

SystemTextJsonCosmosSerializer(JsonSerializerOptions)

Declaration
public SystemTextJsonCosmosSerializer(JsonSerializerOptions jsonSerializerOptions)
Parameters
Type Name Description
JsonSerializerOptions jsonSerializerOptions

Methods

| Edit this page View Source

FromStream<T>(Stream)

Convert a Stream of JSON to an object. The implementation is responsible for Disposing of the stream, including when an exception is thrown, to avoid memory leaks.

Declaration
public override T FromStream<T>(Stream stream)
Parameters
Type Name Description
Stream stream

The Stream response containing JSON from Cosmos DB.

Returns
Type Description
T

The object deserialized from the stream.

Type Parameters
Name Description
T

Any type passed to Container.

Overrides
CosmosSerializer.FromStream<T>(Stream)
| Edit this page View Source

SerializeMemberName(MemberInfo)

Convert a MemberInfo to a string for use in LINQ query translation. This must be implemented when using a custom serializer for LINQ queries.

Declaration
public override string? SerializeMemberName(MemberInfo memberInfo)
Parameters
Type Name Description
MemberInfo memberInfo

Any MemberInfo used in the query.

Returns
Type Description
string

A serialized representation of the member.

Overrides
CosmosLinqSerializer.SerializeMemberName(MemberInfo)
| Edit this page View Source

ToStream<T>(T)

Convert the object to a Stream. The caller will take ownership of the stream and ensure it is correctly disposed of. Stream.CanRead must be true.

Declaration
public override Stream ToStream<T>(T input)
Parameters
Type Name Description
T input

Any type passed to Container.

Returns
Type Description
Stream

A readable Stream containing JSON of the serialized object.

Type Parameters
Name Description
T
Overrides
CosmosSerializer.ToStream<T>(T)
  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com