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
TClassThe type of the class.
- Inheritance
-
SerializerBase<TClass>BsonClassMapSerializer<TClass>
- Implements
-
IBsonSerializer<TClass>
- Inherited Members
- Extension Methods
Constructors
BsonClassMapSerializer(BsonClassMap)
Initializes a new instance of the BsonClassMapSerializer class.
public BsonClassMapSerializer(BsonClassMap classMap)
Parameters
classMapBsonClassMapThe 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
trueif 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
contextBsonDeserializationContextThe deserialization context.
argsBsonDeserializationArgsThe deserialization args.
Returns
- TClass
A deserialized value.
DeserializeClass(BsonDeserializationContext)
Deserializes a value.
public TClass DeserializeClass(BsonDeserializationContext context)
Parameters
contextBsonDeserializationContextThe 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
documentobjectThe document.
idobjectThe Id.
idNominalTypeTypeThe nominal type of the Id.
idGeneratorIIdGeneratorThe 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
contextBsonSerializationContextThe serialization context.
argsBsonSerializationArgsThe serialization args.
valueTClassThe object.
SetDocumentId(object, object)
Sets the document Id.
public void SetDocumentId(object document, object id)
Parameters
TryGetMemberSerializationInfo(string, out BsonSerializationInfo)
Tries to get the serialization info for a member.
public bool TryGetMemberSerializationInfo(string memberName, out BsonSerializationInfo serializationInfo)
Parameters
memberNamestringName of the member.
serializationInfoBsonSerializationInfoThe serialization information.
Returns
- bool
trueif the serialization info exists; otherwisefalse.