Class AsObjectIdAttribute
Use this attribute to mark a string property to store the value in MongoDB as ObjectID if it is a valid ObjectId string. If it is not a valid ObjectId string, it will be stored as string. This is useful when using custom formats for the ID field.
[AttributeUsage(AttributeTargets.Property)]
public class AsObjectIdAttribute : BsonSerializerAttribute, IBsonMemberMapAttribute
- Inheritance
-
BsonSerializerAttributeAsObjectIdAttribute
- Implements
-
IBsonMemberMapAttribute
- Inherited Members
-
BsonSerializerAttribute.Apply(BsonMemberMap)BsonSerializerAttribute.SerializerType
Constructors
AsObjectIdAttribute()
Use this attribute to mark a string property to store the value in MongoDB as ObjectID if it is a valid ObjectId string. If it is not a valid ObjectId string, it will be stored as string. This is useful when using custom formats for the ID field.
public AsObjectIdAttribute()