MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize C# (CSharp) Méthode

Deserialize() public méthode

Deserializes an object from a BsonReader.
public Deserialize ( MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options ) : object
bsonReader MongoDB.Bson.IO.BsonReader The BsonReader.
nominalType System.Type The nominal type of the object.
options IBsonSerializationOptions The serialization options.
Résultat object
        public object Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options)
        {
            VerifyNominalType(nominalType);
            if (bsonReader.GetCurrentBsonType() == Bson.BsonType.Null)
            {
                bsonReader.ReadNull();
                return null;
            }
            else
            {
                var discriminatorConvention = _classMap.GetDiscriminatorConvention();
                var actualType = discriminatorConvention.GetActualType(bsonReader, nominalType);
                if (actualType != nominalType)
                {
                    var serializer = BsonSerializer.LookupSerializer(actualType);
                    if (serializer != this)
                    {
                        return serializer.Deserialize(bsonReader, nominalType, actualType, options);
                    }
                }

                return Deserialize(bsonReader, nominalType, actualType, options);
            }
        }

Same methods

BsonClassMapSerializer::Deserialize ( MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options ) : object