public Expression BuildSource(Expression expression, Type destinationType, IMappingConfiguration mappingConfiguration)
        {
            if (!destinationType.IsDictionary())
            {
                return(null);
            }

            var destinationElementType = TypeUtils.GetElementTypeOfEnumerable(destinationType);

            var add = destinationType.GetMethod("Add");
            var destinationKeyType   = destinationElementType.GetProperty("Key").PropertyType;
            var destinationValueType = destinationElementType.GetProperty("Value").PropertyType;

            IEnumerable <ElementInit> initializers = expression.Type.GetReadableMembers()
                                                     .Where(m => !excluded.Contains(m.Name))
                                                     .Where(m => !IsPropertyGetter(m))
                                                     .Select(property => Expression.ElementInit(add,
                                                                                                BuildSource(mappingConfiguration, destinationKeyType, Expression.Constant(property.Name)),
                                                                                                BuildSource(mappingConfiguration, destinationValueType, ExpressionEx.Member(expression, property))));

            return(Expression.ListInit(Expression.New(destinationType), initializers));
        }
 public Expression BuildSource(Expression x, Type destinationType, IMappingConfiguration mappingConfiguration)
 {
     return(ExpressionEx.Member(x, memberInfo));
 }