Esempio n. 1
0
        protected override Expression VisitMember(MemberExpression e)
        {
			var isMember = e.Expression != null && e.Expression.NodeType == ExpressionType.Parameter;
        	var isNullableMember = e.Expression != null && e.Expression.NodeType == ExpressionType.MemberAccess 
				&& ((MemberExpression) e.Expression).Expression != null 
				&& ((MemberExpression) e.Expression).Expression.NodeType == ExpressionType.Parameter;
			
        	if (isMember || isNullableMember)
			{
				var memberNode = CreateNewMemberNode(e);
				_nodes.AddNode(memberNode);

				return e;
			}

            try
            {
                var value = e.Evaluate();

                var constantExpression = Expression.Constant(value);

                return Visit(constantExpression);
            }
            catch
            {
                var memberNode = CreateNewMemberNode(e);
                _nodes.AddNode(memberNode);

                return e;
            }
        }