public Expression CreateMapExpression(Type sourceType, Type destinationType, System.Collections.Generic.IDictionary <string, object> parameters = null, params MemberInfo[] membersToExpand) { parameters = parameters ?? new Dictionary <string, object>(); var cachedExpression = _expressionCache.GetOrAdd(new ExpressionRequest(sourceType, destinationType, membersToExpand), tp => CreateMapExpression(tp, new ConcurrentDictionary <ExpressionRequest, int>())); if (!parameters.Any()) { return(cachedExpression); } var visitor = new ConstantExpressionReplacementVisitor(parameters); return(visitor.Visit(cachedExpression)); }
public Expression CreateMapExpression(Type sourceType, Type destinationType, ObjectDictionary parameters = null, params MemberInfo[] membersToExpand) { //TODO: this appears to be very definitely new parameters = parameters ?? new Dictionary<string, object>(); var cachedExpression = ExpressionCache.GetOrAdd(new ExpressionRequest(sourceType, destinationType, membersToExpand), tp => CreateMapExpression(tp, DictionaryFactory.CreateDictionary<ExpressionRequest, int>())); if (!parameters.Any()) return cachedExpression; var visitor = new ConstantExpressionReplacementVisitor(parameters); return visitor.Visit(cachedExpression); }