Table of Contents

Class BsonClassMapSerializer<TClass>

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

Represents a serializer for a class map.

public class BsonClassMapSerializer<TClass> : SerializerBase<TClass>, IBsonSerializer<TClass>, IBsonIdProvider, IBsonDocumentSerializer, IBsonSerializer, IBsonPolymorphicSerializer

Type Parameters

TClass

The type of the class.

Inheritance
BsonClassMapSerializer<TClass>
Implements
Inherited Members
Extension Methods

Constructors

BsonClassMapSerializer(BsonClassMap)

Initializes a new instance of the BsonClassMapSerializer class.

public BsonClassMapSerializer(BsonClassMap classMap)

Parameters

classMap BsonClassMap

The class map.

Properties

IsDiscriminatorCompatibleWithObjectSerializer

Gets a value indicating whether this serializer's discriminator is compatible with the object serializer.

public bool IsDiscriminatorCompatibleWithObjectSerializer { get; }

Property Value

bool

true if this serializer's discriminator is compatible with the object serializer; otherwise, false.

Methods

Deserialize(BsonDeserializationContext, BsonDeserializationArgs)

Deserializes a value.

public override TClass Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)

Parameters

context BsonDeserializationContext

The deserialization context.

args BsonDeserializationArgs

The deserialization args.

Returns

TClass

A deserialized value.

DeserializeClass(BsonDeserializationContext)

Deserializes a value.

public TClass DeserializeClass(BsonDeserializationContext context)

Parameters

context BsonDeserializationContext

The deserialization context.

Returns

TClass

A deserialized value.

GetDocumentId(object, out object, out Type, out IIdGenerator)

Gets the document Id.

public bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator)

Parameters

document object

The document.

id object

The Id.

idNominalType Type

The nominal type of the Id.

idGenerator IIdGenerator

The IdGenerator for the Id type.

Returns

bool

True if the document has an Id.

Serialize(BsonSerializationContext, BsonSerializationArgs, TClass)

Serializes a value.

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

Parameters

context BsonSerializationContext

The serialization context.

args BsonSerializationArgs

The serialization args.

value TClass

The object.

SetDocumentId(object, object)

Sets the document Id.

public void SetDocumentId(object document, object id)

Parameters

document object

The document.

id object

The Id.

TryGetMemberSerializationInfo(string, out BsonSerializationInfo)

Tries to get the serialization info for a member.

public bool TryGetMemberSerializationInfo(string memberName, out BsonSerializationInfo serializationInfo)

Parameters

memberName string

Name of the member.

serializationInfo BsonSerializationInfo

The serialization information.

Returns

bool

true if the serialization info exists; otherwise false.