public override void ApplyAttribute(IBsonSerializer serializer, Attribute attribute)
{
EnsureNotFrozen();
var representationAttribute = attribute as BsonRepresentationAttribute;
if (representationAttribute != null)
{
_allowOverflow = representationAttribute.AllowOverflow;
_allowTruncation = representationAttribute.AllowTruncation;
_representation = representationAttribute.Representation;
return;
}
var message = string.Format("A serialization options attribute of type {0} cannot be applied to serialization options of type {1}.",
BsonUtils.GetFriendlyTypeName(attribute.GetType()), BsonUtils.GetFriendlyTypeName(GetType()));
throw new NotSupportedException(message);
}