Table of Contents

Class BsonRepresentationAttribute

Namespace
MongoDB.Bson.Serialization.Attributes
Assembly
MongoDB.Bson.dll

Specifies the external representation and related options for this field or property.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)]
public class BsonRepresentationAttribute : BsonSerializationOptionsAttribute, IBsonMemberMapAttribute
Inheritance
BsonRepresentationAttribute
Implements
Inherited Members
Extension Methods

Constructors

BsonRepresentationAttribute(BsonType)

Initializes a new instance of the BsonRepresentationAttribute class.

public BsonRepresentationAttribute(BsonType representation)

Parameters

representation BsonType

The external representation.

Properties

AllowOverflow

Gets or sets whether to allow overflow.

public bool AllowOverflow { get; set; }

Property Value

bool

AllowTruncation

Gets or sets whether to allow truncation.

public bool AllowTruncation { get; set; }

Property Value

bool

Representation

Gets the external representation.

public BsonType Representation { get; }

Property Value

BsonType

Methods

Apply(IBsonSerializer)

Reconfigures the specified serializer by applying this attribute to it.

protected override IBsonSerializer Apply(IBsonSerializer serializer)

Parameters

serializer IBsonSerializer

The serializer.

Returns

IBsonSerializer

A reconfigured serializer.