Пример #1
0
        static int EvaluateTakeSkipValue(Query query, Expression expr, IDataContext?db, object?[]?ps, int qn,
                                         ISqlExpression sqlExpr)
        {
            var parameterValues = new SqlParameterValues();

            SetParameters(query, expr, db, ps, qn, parameterValues);

            var evaluated = sqlExpr.EvaluateExpression(new EvaluationContext(parameterValues)) as int?;

            if (evaluated == null)
            {
                throw new InvalidOperationException($"Can not evaluate integer expression from '{sqlExpr}'.");
            }
            return(evaluated.Value);
        }