Class ExpandoObjectSerializer
- Namespace
- MongoDB.Bson.Serialization.Serializers
- Assembly
- MongoDB.Bson.dll
Serializer for ExpandoObject.
public class ExpandoObjectSerializer : DynamicDocumentBaseSerializer<ExpandoObject>, IBsonSerializer<ExpandoObject>, IBsonSerializer
- Inheritance
-
ExpandoObjectSerializer
- Implements
- Inherited Members
- Extension Methods
Remarks
The use of ExpandoObject will serialize any List<T> without type information. To get the best experience out of using an ExpandoObject, any member wanting to be used as an array should use List<T>.
Constructors
ExpandoObjectSerializer()
Initializes a new instance of the ExpandoObjectSerializer class.
public ExpandoObjectSerializer()
Methods
ConfigureDeserializationContext(Builder)
Configures the deserialization context.
protected override void ConfigureDeserializationContext(BsonDeserializationContext.Builder builder)
Parameters
builderBsonDeserializationContext.BuilderThe builder.
ConfigureSerializationContext(Builder)
Configures the serialization context.
protected override void ConfigureSerializationContext(BsonSerializationContext.Builder builder)
Parameters
builderBsonSerializationContext.BuilderThe builder.
CreateDocument()
Creates the document.
protected override ExpandoObject CreateDocument()
Returns
SetValueForMember(ExpandoObject, string, object)
Sets the value for the member.
protected override void SetValueForMember(ExpandoObject document, string memberName, object value)
Parameters
documentExpandoObjectThe document.
memberNamestringName of the member.
valueobjectThe value.
TryGetValueForMember(ExpandoObject, string, out object)
Tries to get the value for a member. Returns true if the member should be serialized.
protected override bool TryGetValueForMember(ExpandoObject value, string memberName, out object memberValue)
Parameters
valueExpandoObjectThe value.
memberNamestringName of the member.
memberValueobjectThe member value.
Returns
- bool
trueif the member should be serialized; otherwisefalse.