示例#1
0
        /// <summary>
        /// Specifies a sorting rule against a column in the query
        /// </summary>
        /// <param name="columnName">The column name</param>
        /// <param name="direction">The sort direction</param>
        public void SortColumn
        (
            string columnName,
            SortDirection direction
        )
        {
            Validate.IsNotEmpty(columnName);

            var columnFound = HasColumn(columnName);

            if (false == columnFound)
            {
                throw new InvalidOperationException
                      (
                          $"The column '{columnName}' does not exist."
                      );
            }

            var rule = new QuerySortingRule
                       (
                columnName,
                direction
                       );

            _sortingRules[columnName] = rule;
        }
示例#2
0
        /// <summary>
        /// Specifies a sorting rule against a column in the query
        /// </summary>
        /// <param name="columnName">The column name</param>
        /// <param name="direction">The sort direction</param>
        public void SortColumn
        (
            string columnName,
            SortDirection direction
        )
        {
            Validate.IsNotEmpty(columnName);

            var columnFound = this.Columns.Any
                              (
                info => info.Column.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase)
                              );

            if (false == columnFound)
            {
                throw new InvalidOperationException
                      (
                          $"The column '{columnName}' does not exist."
                      );
            }

            var rule = new QuerySortingRule
                       (
                columnName,
                direction
                       );

            _sortingRules[columnName] = rule;
        }