Table of Contents

Class BsonClassMap

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

Represents a mapping between a class and a BSON document.

public class BsonClassMap
Inheritance
BsonClassMap
Derived
BsonClassMap<TClass>
Inherited Members
Extension Methods

Constructors

BsonClassMap(Type)

Initializes a new instance of the BsonClassMap class.

BsonClassMap(Type, BsonClassMap)

Initializes a new instance of the BsonClassMap class.

Properties

AllMemberMaps

Gets all the member maps (including maps for inherited members).

BaseClassMap

Gets the base class map.

ClassType

Gets the class type.

ConventionPack

Gets the conventions used for auto mapping.

CreatorMaps

Gets the constructor maps.

DeclaredMemberMaps

Gets the declared member maps (only for members declared in this class).

Discriminator

Gets the discriminator.

DiscriminatorIsRequired

Gets whether a discriminator is required when serializing this class.

ExtraElementsMemberMap

Gets the member map of the member used to hold extra elements.

HasCreatorMaps

Gets whether this class map has any creator maps.

HasRootClass

Gets whether this class has a root class ancestor.

IdMemberMap

Gets the Id member map (null if none).

IgnoreExtraElements

Gets whether extra elements should be ignored when deserializing.

IgnoreExtraElementsIsInherited

Gets whether the IgnoreExtraElements value should be inherited by derived classes.

IsAnonymous

Gets whether this class is anonymous.

IsFrozen

Gets whether the class map is frozen.

IsRootClass

Gets whether this class is a root class.

KnownTypes

Gets the known types of this class.

Methods

AddKnownType(Type)

Adds a known type to the class map.

AutoMap()

Automaps the class.

CreateInstance()

Creates an instance of the class.

Equals(object)
Freeze()

Freezes the class map.

GetHashCode()
GetMemberInfoType(MemberInfo)

Gets the type of a member.

GetMemberMap(string)

Gets a member map (only considers members declared in this class).

GetMemberMapForElement(string)

Gets the member map for a BSON element.

GetRegisteredClassMaps()

Gets all registered class maps.

IsClassMapRegistered(Type)

Checks whether a class map is registered for a type.

LookupClassMap(Type)

Looks up a class map (will AutoMap the class if no class map is registered).

MapConstructor(ConstructorInfo)

Creates a creator map for a constructor and adds it to the class map.

MapConstructor(ConstructorInfo, params string[])

Creates a creator map for a constructor and adds it to the class map.

MapCreator(Delegate)

Creates a creator map and adds it to the class.

MapCreator(Delegate, params string[])

Creates a creator map and adds it to the class.

MapExtraElementsField(string)

Creates a member map for the extra elements field and adds it to the class map.

MapExtraElementsMember(MemberInfo)

Creates a member map for the extra elements member and adds it to the class map.

MapExtraElementsProperty(string)

Creates a member map for the extra elements property and adds it to the class map.

MapFactoryMethod(MethodInfo)

Creates a creator map for a factory method and adds it to the class.

MapFactoryMethod(MethodInfo, params string[])

Creates a creator map for a factory method and adds it to the class.

MapField(string)

Creates a member map for a field and adds it to the class map.

MapIdField(string)

Creates a member map for the Id field and adds it to the class map.

MapIdMember(MemberInfo)

Creates a member map for the Id member and adds it to the class map.

MapIdProperty(string)

Creates a member map for the Id property and adds it to the class map.

MapMember(MemberInfo)

Creates a member map for a member and adds it to the class map.

MapProperty(string)

Creates a member map for a property and adds it to the class map.

RegisterClassMap(BsonClassMap)

Registers a class map.

RegisterClassMap<TClass>()

Creates and registers a class map.

RegisterClassMap<TClass>(Action<BsonClassMap<TClass>>)

Creates and registers a class map.

Reset()

Resets the class map back to its initial state.

SetCreator(Func<object>)

Sets the creator for the object.

SetDiscriminator(string)

Sets the discriminator.

SetDiscriminatorIsRequired(bool)

Sets whether a discriminator is required when serializing this class.

SetExtraElementsMember(BsonMemberMap)

Sets the member map of the member used to hold extra elements.

SetIdMember(BsonMemberMap)

Sets the Id member.

SetIgnoreExtraElements(bool)

Sets whether extra elements should be ignored when deserializing.

SetIgnoreExtraElementsIsInherited(bool)

Sets whether the IgnoreExtraElements value should be inherited by derived classes.

SetIsRootClass(bool)

Sets whether this class is a root class.

TryRegisterClassMap<TClass>()

Registers a class map if it is not already registered.

TryRegisterClassMap<TClass>(BsonClassMap<TClass>)

Registers a class map if it is not already registered.

TryRegisterClassMap<TClass>(Action<BsonClassMap<TClass>>)

Registers a class map if it is not already registered.

TryRegisterClassMap<TClass>(Func<BsonClassMap<TClass>>)

Registers a class map if it is not already registered.

UnmapConstructor(ConstructorInfo)

Removes a creator map for a constructor from the class map.

UnmapFactoryMethod(MethodInfo)

Removes a creator map for a factory method from the class map.

UnmapField(string)

Removes the member map for a field from the class map.

UnmapMember(MemberInfo)

Removes a member map from the class map.

UnmapProperty(string)

Removes the member map for a property from the class map.