Table of Contents

Class DynamicDocumentBaseSerializer<T>

Namespace
MongoDB.Bson.Serialization.Serializers
Assembly
MongoDB.Bson.dll

Base serializer for dynamic types.

public abstract class DynamicDocumentBaseSerializer<T> : SerializerBase<T>, IBsonSerializer<T>, IBsonSerializer where T : class, IDynamicMetaObjectProvider

Type Parameters

T

The dynamic type.

Inheritance
DynamicDocumentBaseSerializer<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

DynamicDocumentBaseSerializer()

Initializes a new instance of the DynamicDocumentBaseSerializer<T> class.

protected DynamicDocumentBaseSerializer()

Methods

ConfigureDeserializationContext(Builder)

Configures the deserialization context.

protected abstract void ConfigureDeserializationContext(BsonDeserializationContext.Builder builder)

Parameters

builder BsonDeserializationContext.Builder

The builder.

ConfigureSerializationContext(Builder)

Configures the serialization context.

protected abstract void ConfigureSerializationContext(BsonSerializationContext.Builder builder)

Parameters

builder BsonSerializationContext.Builder

The builder.

CreateDocument()

Creates the document.

protected abstract T CreateDocument()

Returns

T

A T

Deserialize(BsonDeserializationContext, BsonDeserializationArgs)

Deserializes a value.

public override T Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)

Parameters

context BsonDeserializationContext

The deserialization context.

args BsonDeserializationArgs

The deserialization args.

Returns

T

A deserialized value.

Serialize(BsonSerializationContext, BsonSerializationArgs, T)

Serializes a value.

public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, T value)

Parameters

context BsonSerializationContext

The serialization context.

args BsonSerializationArgs

The serialization args.

value T

The object.

SetValueForMember(T, string, object)

Sets the value for the member.

protected abstract void SetValueForMember(T document, string memberName, object value)

Parameters

document T

The document.

memberName string

Name of the member.

value object

The value.

TryGetValueForMember(T, string, out object)

Tries to get the value for a member. Returns true if the member should be serialized.

protected abstract bool TryGetValueForMember(T document, string memberName, out object value)

Parameters

document T

The document.

memberName string

Name of the member.

value object

The value.

Returns

bool

true if the member should be serialized; otherwise false.