Class BsonDefaultValueAttribute
- Namespace
- MongoDB.Bson.Serialization.Attributes
- Assembly
- MongoDB.Bson.dll
Specifies the default value for a field or property.
[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)]
public class BsonDefaultValueAttribute : Attribute, IBsonMemberMapAttribute
- Inheritance
-
BsonDefaultValueAttribute
- Implements
- Inherited Members
- Extension Methods
Constructors
BsonDefaultValueAttribute(object)
Initializes a new instance of the BsonDefaultValueAttribute class.
public BsonDefaultValueAttribute(object defaultValue)
Parameters
defaultValue
objectThe default value.
Properties
DefaultValue
Gets the default value.
public object DefaultValue { get; }
Property Value
SerializeDefaultValue
Gets or sets whether to serialize the default value.
[Obsolete("Use BsonIgnoreIfDefaultAttribute instead.")]
public bool SerializeDefaultValue { get; set; }
Property Value
Methods
Apply(BsonMemberMap)
Applies a modification to the member map.
public void Apply(BsonMemberMap memberMap)
Parameters
memberMap
BsonMemberMapThe member map.