public bool HasOpenGenericTypeMapDefined(ResolutionContext context) { var sourceGenericDefinition = context.SourceType.GetGenericTypeDefinition(); var destGenericDefinition = context.DestinationType.GetGenericTypeDefinition(); var genericTypePair = new TypePair(sourceGenericDefinition, destGenericDefinition); return(_typeMapExpressionCache.ContainsKey(genericTypePair)); }
public TypeMap ResolveTypeMap(TypePair typePair) { var typeMap = _typeMapPlanCache.GetOrAdd(typePair, _ => GetRelatedTypePairs(_) .Select( tp => FindTypeMapFor(tp) ?? (_typeMapPlanCache.ContainsKey(tp) ? _typeMapPlanCache[tp] : null)) .FirstOrDefault(tm => tm != null)); return(typeMap); }