Пример #1
0
        public SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadOnlyList <SqlExpression> arguments)
        {
            if (!(method.Equals(SubstringOnlyStartMethod) || method.Equals(SubstringStartAndLengthMethod)))
            {
                return(null);
            }

            var fromExpression = _fbSqlExpressionFactory.Add(arguments[0], _fbSqlExpressionFactory.Constant(1));
            var forExpression  = arguments.Count == 2 ? arguments[1] : null;

            return(_fbSqlExpressionFactory.Substring(instance, fromExpression, forExpression));
        }