private string GetSqlGrid(LazyPagination pagger) { var sql = _sql ?? _gridModel.GridSql; sql = _filter.AddCondition(sql); var orderColumns = _gridModel.Column.First(x => string.Equals(x.SystemName, _gridOptions.SortOptions.Column, StringComparison.OrdinalIgnoreCase)); string orderColumn = orderColumns.OrderByName ?? orderColumns.SystemName; var orderBy = new OrderByBuilder(orderColumn, _gridOptions.SortOptions.Direction).QueryResult; sql += Environment.NewLine + orderBy; sql += Environment.NewLine + pagger.GetOffestRow(); return(sql); }