public void SerializeProperty(
     BsonWriter bsonWriter,
     object obj,
     BsonPropertyMap propertyMap
 )
 {
     var value = (int) propertyMap.Getter(obj);
     bsonWriter.WriteInt32(propertyMap.ElementName, value);
 }
 public void SerializeProperty(
     BsonWriter bsonWriter,
     object obj,
     BsonPropertyMap propertyMap
 )
 {
     var value = (BsonInt32) propertyMap.Getter(obj);
     if (value == null) {
         bsonWriter.WriteNull(propertyMap.ElementName);
     } else {
         bsonWriter.WriteInt32(propertyMap.ElementName, value.Value);
     }
 }
 public void SerializeProperty(
     BsonWriter bsonWriter,
     object obj,
     BsonPropertyMap propertyMap
 )
 {
     var value = (byte) propertyMap.Getter(obj);
     if (propertyMap.UseCompactRepresentation) {
         bsonWriter.WriteInt32(propertyMap.ElementName, value);
     } else {
         bsonWriter.WriteDocumentName(propertyMap.ElementName);
         bsonWriter.WriteStartDocument();
         bsonWriter.WriteString("_t", typeof(byte).FullName);
         bsonWriter.WriteInt32("v", value);
         bsonWriter.WriteEndDocument();
     }
 }