public void SerializeBson(BsonSerializingContext context) { context.BsonWriter.WriteStartDocument(); foreach (var item in _values) { if (context.Filter.IsOk(Proxy, _typeConfig.Type, item.Key)) { context.BsonWriter.WriteName(item.Key); _manager.SerializeBsonValue(item.Value, context); } } context.BsonWriter.WriteEndDocument(); }
public void SerializeBson(BsonSerializingContext context) { context.BsonWriter.WriteStartDocument(); foreach (var item in _inner) { if (string.IsNullOrEmpty(item.Key)) { Log.Warning($"Trying to bserialize empty value for Dictionary of {_typeConfig.ValueType.Type}"); } else if (context.Filter.IsOk(item.Value, _typeConfig.ValueType.Type, null)) { context.BsonWriter.WriteName(item.Key); _manager.SerializeBsonValue(item.Value, context); } } context.BsonWriter.WriteEndDocument(); }