Skip to content

Commit

Permalink
Adds Count Capabilites.
Browse files Browse the repository at this point in the history
  • Loading branch information
jas-valgotar committed Jan 22, 2025
1 parent 70dc84b commit eafee7d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public void Refresh()
{
_cachedRows = null;
}

public Task<int> GetCountAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel)
{
throw new NotImplementedException();
}
}

internal static class ODataParametersExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public abstract class TableDelegationInfo
[Obsolete("preview")]
public SummarizeCapabilities SummarizeCapabilities { get; init; }

[Obsolete("preview")]
public CountCapabilities CountCapabilities { get; init; }

// Defines ungroupable columns
public GroupRestrictions GroupRestriction { get; init; }

Expand Down Expand Up @@ -299,6 +302,29 @@ public enum SummarizeMethod
CountRows
}

[Obsolete("preview")]
public class CountCapabilities
{
public CountCapabilities()
{
}

public virtual bool IsCountableTable()
{
return false;
}

public virtual bool IsCountableAfterJoin()
{
return false;
}

public virtual bool IsCountableAfterSummarize()
{
return false;
}
}

public sealed class FilterRestrictions
{
// List of required properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ public interface IDelegatableTableValue
/// <param name="cancel"></param>
/// <returns></returns>
Task<IReadOnlyCollection<DValue<RecordValue>>> GetRowsAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel);

/// <summary>
/// Evaluation will invoke this method on delegated count calls.
/// </summary>
/// <param name="services">Pre-eval services.</param>
/// <param name="parameters">Delegation parameters.</param>
/// <param name="cancel"></param>
/// <returns>Return total count of rows. Returns -1 if rows could not be counted.</returns>
Task<int> GetCountAsync(IServiceProvider services, DelegationParameters parameters, CancellationToken cancel);
}

/// <summary>
Expand Down

0 comments on commit eafee7d

Please sign in to comment.