private MatchData Match(BsonCreatorMap creatorMap, Dictionary <string, object> values) { var argumentCount = 0; var defaultValueCount = 0; // a creator is a match if we have a value for each parameter (either a deserialized value or a default value) foreach (var elementName in creatorMap.ElementNames) { if (values.ContainsKey(elementName)) { argumentCount++; } else if (creatorMap.HasDefaultValue(elementName)) { defaultValueCount++; } else { return(null); } } return(new MatchData { CreatorMap = creatorMap, ArgumentCount = argumentCount, DefaultValueCount = defaultValueCount }); }
private MatchData Match(BsonCreatorMap creatorMap, Dictionary<string, object> values) { var argumentCount = 0; var defaultValueCount = 0; // a creator is a match if we have a value for each parameter (either a deserialized value or a default value) foreach (var elementName in creatorMap.ElementNames) { if (values.ContainsKey(elementName)) { argumentCount++; } else if (creatorMap.HasDefaultValue(elementName)) { defaultValueCount++; } else { return null; } } return new MatchData { CreatorMap = creatorMap, ArgumentCount = argumentCount, DefaultValueCount = defaultValueCount }; }