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
builder
BsonDeserializationContext.BuilderThe builder.
ConfigureSerializationContext(Builder)
Configures the serialization context.
protected override void ConfigureSerializationContext(BsonSerializationContext.Builder builder)
Parameters
builder
BsonSerializationContext.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
document
ExpandoObjectThe document.
memberName
stringName of the member.
value
objectThe 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
value
ExpandoObjectThe value.
memberName
stringName of the member.
memberValue
objectThe member value.
Returns
- bool
true
if the member should be serialized; otherwisefalse
.