public void DeserializeProperty(
     BsonReader bsonReader,
     object obj,
     BsonPropertyMap propertyMap
 )
 {
     var bsonType = bsonReader.PeekBsonType();
     BsonInt64 value;
     if (bsonType == BsonType.Null) {
         bsonReader.ReadNull(propertyMap.ElementName);
         value = null;
     } else {
         value = BsonInt64.Create(bsonReader.ReadInt64(propertyMap.ElementName));
     }
     propertyMap.Setter(obj, value);
 }
 public void DeserializeProperty(
     BsonReader bsonReader,
     object obj,
     BsonPropertyMap propertyMap
 )
 {
     BsonType bsonType = bsonReader.PeekBsonType();
     ulong value;
     if (bsonType == BsonType.Int64) {
         value = (ulong) bsonReader.ReadInt64(propertyMap.ElementName);
     } else if (bsonType == BsonType.Document) {
         bsonReader.ReadDocumentName(propertyMap.ElementName);
         bsonReader.ReadStartDocument();
         bsonReader.VerifyString("_t", typeof(ulong).FullName);
         value = (ulong) bsonReader.ReadInt64("v");
         bsonReader.ReadEndDocument();
     } else {
         throw new FileFormatException("Element is not valid System.UInt64");
     }
     propertyMap.Setter(obj, value);
 }
 public void DeserializeProperty(
     BsonReader bsonReader,
     object obj,
     BsonPropertyMap propertyMap
 )
 {
     var value = bsonReader.ReadInt64(propertyMap.ElementName);
     propertyMap.Setter(obj, value);
 }
 public void DeserializeProperty(
     BsonReader bsonReader,
     object obj,
     BsonPropertyMap propertyMap
 )
 {
     BsonType bsonType = bsonReader.PeekBsonType();
     DateTimeOffset value;
     if (bsonType == BsonType.Array) {
         bsonReader.ReadArrayName(propertyMap.ElementName);
         bsonReader.ReadStartDocument();
         var dateTime = new DateTime(bsonReader.ReadInt64("0"));
         var offset = new TimeSpan(bsonReader.ReadInt64("1"));
         bsonReader.ReadEndDocument();
         value = new DateTimeOffset(dateTime, offset);
     } else if (bsonType == BsonType.Document) {
         bsonReader.ReadDocumentName(propertyMap.ElementName);
         bsonReader.ReadStartDocument();
         bsonReader.VerifyString("_t", typeof(DateTimeOffset).FullName);
         var dateTime = DateTime.Parse(bsonReader.ReadString("dt")); // Kind = DateTimeKind.Unspecified
         var offset = TimeSpan.Parse(bsonReader.ReadString("o"));
         bsonReader.ReadEndDocument();
         value = new DateTimeOffset(dateTime, offset);
     } else {
         throw new FileFormatException("Element is not valid System.DateTimeOffset");
     }
     propertyMap.Setter(obj, value);
 }