Example #1
0
        public SelectOperation <T> OrderBy <TResult>(Expression <Func <T, TResult> > columnSelector)
        {
            ExpressionResolver expressionResolver = new ExpressionResolver();
            string             columnName         = expressionResolver.ResolveOrderBy <T, TResult>(columnSelector);

            if (_orderBy == null)
            {
                _orderBy = @"
ORDER BY " + columnName;
            }
            else
            {
                _orderBy += ", " + columnName;
            }

            return(this);
        }
Example #2
0
        public SelectOperation <T> Where(Expression <Func <T, bool> > predicate)
        {
            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }
            if (_where != null)
            {
                throw new InvalidOperationException("The 'Where' method already used.");
            }

            ExpressionResolver expressionResolver = new ExpressionResolver();

            _where = @"
WHERE " + expressionResolver.ResolveWhere(predicate);

            return(this);
        }