Show / Hide Table of Contents

Interface IArchiveProviderHasRows

This interface defines the property of having rows of an archive provider. It is implemented by the QueryProviderBase and MultiQueryProviderBase base classes.

Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public interface IArchiveProviderHasRows

Methods

Close()

Call this method after the last desired row has been read; this gives the provider the chance to close and free any underlying queries

Declaration
void Close()

GetReaderAsync(string, CancellationToken)

Start the reader and return an IDataReader (which, as we remember, also inherits IDataRecord for access to individual data fields). This provides an alternative, more generic and more standards-based interface to data. Use either GetRows or GetReader on any particular archive provider instance.

Declaration
Task<DbDataReader> GetReaderAsync(string options, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string options
CancellationToken cancellationToken
Returns
Type Description
Task<DbDataReader>

GetResultInformationAsync()

Get additional information about the result, such as row count or other optional items. This method should be called after GetRowsAsync(string, CancellationToken), but before Close.

Declaration
Task<ArchiveResultInformation> GetResultInformationAsync()
Returns
Type Description
Task<ArchiveResultInformation>

GetRowsAsync(string, CancellationToken)

Start the query and return an iterator. The .Current property will be a valid ArchiveRow containing one row, as long as a previous call to .MoveNext returned true. This is the standard semantics for an iterator. Do remember to call Close afterwards, to clean up all resources.

Declaration
IAsyncEnumerable<ArchiveRow> GetRowsAsync(string options, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string options

A set of options, using the query string format (name=value&...). Can be null or empty.

OptionPurpose/effect
countrows=truePrepare to return a count of the full result set
Options set here may trigger additional, asynchronous processing that will prepare results for the GetInformation method, if possible.
CancellationToken cancellationToken
Returns
Type Description
IAsyncEnumerable<ArchiveRow>

An iterator, following the usual conventions. MoveNext will return false when there are no more rows, which can either be because the result set is exhausted, or because the page size has been reached

Remarks

You can use the await foreach keyword to iterate over rows, like this:

IArchiveProvider provider = ArchiveProviderFactory.Create("person");
// not shown - set desired columns, entities, restrictions, paging
await foreach( ArchiveRow row in provider.GetRowsAsync() )
{
	// process row here
}
provider.Close();

SetPagingInfo(int, int)

Set the paging properties of the provider. The default is to fetch page zero, of one thousand (1000) rows. A more reasonable page size is probably around 100. Note that the query processing strategy may change for very large pages (more than 1000) and give significantly longer response times. Performance is improved by setting the page size low, as long as you don't set it lower than what you realistically expect to need (fetching multiple pages is more expensive than fetching one).

Declaration
void SetPagingInfo(int pageSize, int pageNumber)
Parameters
Type Name Description
int pageSize

Desired page size

int pageNumber

Desired page number to return

Extension Methods

EnumUtil.MapEnums<From, To>(From)
IArchiverProviderHasRowsExtensions.GetRowsAsync(IArchiveProviderHasRows, CancellationToken)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top