Ejemplo n.º 1
0
        public void Serialize(MongoDB.Bson.IO.BsonWriter bsonWriter, Type nominalType, IBsonSerializationOptions options)
        {
            bsonWriter.WriteStartDocument();
            var keyValues = AsDictionary();
            foreach (var key in keyValues.Keys)
            {
                if (keyValues[key] == null || keyValues[key] == "" || key == "" || key == "_id") continue;
                bsonWriter.WriteName(key);
                BsonDefaultSerializer.Instance.GetSerializer(keyValues[key].GetType()).Serialize(bsonWriter,
                    keyValues.GetType(), keyValues[key], options);

            }
            bsonWriter.WriteEndDocument();
        }