Пример #1
0
        public static Expression MakeFunction(ParameterExpression message, string functionName, List <Expression> arguments)
        {
            if (string.Equals(functionName, "NEWID", StringComparison.OrdinalIgnoreCase))
            {
                if (arguments.Count != 0)
                {
                    throw new ArgumentException(SRClient.FilterFunctionIncorrectNumberOfArguments(functionName, 0, arguments.Count), "arguments");
                }
                return(Expression.Call(Constants.NewGuid, new Expression[0]));
            }
            if (!string.Equals(functionName, "P", StringComparison.OrdinalIgnoreCase) && !string.Equals(functionName, "Property", StringComparison.OrdinalIgnoreCase))
            {
                throw new ArgumentException(SRClient.FilterUnknownFunctionName(functionName));
            }
            if (arguments.Count != 1)
            {
                throw new ArgumentException(SRClient.FilterFunctionIncorrectNumberOfArguments(functionName, 1, arguments.Count), "arguments");
            }
            Expression expression = Expression.Constant(PropertyScope.User);

            return(new GetPropertyExpression(message, expression, arguments[0]));
        }