/// <summary>Removes cached resolutions involving conversion paths using the given conversion, if any.</summary> public void Clear(Schema.Conversion conversion) { List <OperatorBindingContext> resolutions = new List <OperatorBindingContext>(); foreach (KeyValuePair <OperatorBindingContext, OperatorBindingContext> entry in _resolutions) { foreach (OperatorMatch match in entry.Value.Matches) { foreach (ConversionContext conversionContext in match.ConversionContexts) { ScalarConversionContext scalarConversionContext = conversionContext as ScalarConversionContext; if (scalarConversionContext != null) { foreach (Schema.ScalarConversionPath path in scalarConversionContext.Paths) { if (path.Contains(conversion)) { resolutions.Add(entry.Value); goto Continue; } } } } } Continue : continue; } foreach (OperatorBindingContext removeContext in resolutions) { _resolutions.Remove(removeContext); } }
/// <summary>Removes cached resolutions involving conversions referencing the given scalar type, if any.</summary> public void Clear(Schema.ScalarType sourceType, Schema.ScalarType targetType) { List <OperatorBindingContext> resolutions = new List <OperatorBindingContext>(); foreach (KeyValuePair <OperatorBindingContext, OperatorBindingContext> entry in _resolutions) { foreach (OperatorMatch match in entry.Value.Matches) { foreach (ConversionContext conversionContext in match.ConversionContexts) { ScalarConversionContext scalarConversionContext = conversionContext as ScalarConversionContext; if (scalarConversionContext != null) { if (!scalarConversionContext.CanConvert && conversionContext.SourceType.Equals(sourceType) || conversionContext.TargetType.Equals(sourceType) || conversionContext.SourceType.Equals(targetType) || conversionContext.TargetType.Equals(targetType)) { resolutions.Add(entry.Value); goto Continue; } foreach (Schema.ScalarConversionPath path in scalarConversionContext.Paths) { if (path.Contains(sourceType) || path.Contains(targetType)) { resolutions.Add(entry.Value); goto Continue; } } } } } Continue : continue; } foreach (OperatorBindingContext removeContext in resolutions) { _resolutions.Remove(removeContext); } }