예제 #1
0
    public QuerySourceBuilder <TDbContext, TDataItem> AddSortKey <TKey>(
        Expression <Func <TDataItem, TKey> > exp, string?label = null)
    {
        if (_sortLabels != null || _sorter != null)
        {
            throw new InvalidOperationException(
                      "cannot add sort keys when sort labels and custom sorter already set");
        }

        if (_sortKeys == null)
        {
            _sortKeys = new();
        }
        _sortKeys.Add(SortKey <TDataItem> .For <TKey>(exp, label));
        return(this);
    }