CosmosExtensionsCountAsyncT(ItemBaseRepositoryT, NullablePartitionKey, CancellationToken) Method

Counts the amount of items in a repository. A partitionKey can be added as a filter. If you want to add a query, use the overload of this method containing the parameter to add a QueryDefinition

Definition

Namespace: MobileTrack.DataContainers.Extensions
Assembly: MobileTrack.DataContainers (in MobileTrack.DataContainers.dll) Version: 0.8+34f1bbd8dc6b32752cfce829cbed66e15113d7ba
internal static Task<int> CountAsync<T>(
	this ItemBaseRepository<T> repository,
	PartitionKey? partitionKey = null,
	CancellationToken cancellationToken = default
)
where T : IIdLabel

Parameters

repository  ItemBaseRepositoryT
Item Container
partitionKey  NullablePartitionKey  (Optional)
Optional:
cancellationToken  CancellationToken  (Optional)
Cancellation token

Type Parameters

T
Item type

Return Value

TaskInt32
Amount of items found

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ItemBaseRepositoryT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

InvalidOperationExceptionThrown if no results were returned

See Also