IFulltextQueryTDocumentFirstOrDefaultAsync(CancellationToken) Method

Asynchronously execute this query and return the first result or the default value for the given type, if no results were found.

Definition

Namespace: SphinxConnector.FluentApi
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
Task<TDocument> FirstOrDefaultAsync(
	CancellationToken cancellationToken
)

Parameters

cancellationToken  CancellationToken
The token to monitor for cancellation requests.

Return Value

TaskTDocument
An instance of TDocument or the default value for the given type.
A task representing the asynchronous operation.

Remarks

This is equivalent to calling Limit(0, 1).ToList()

Exceptions

FulltextExceptionOccurs when there is an error during the execution of the query.
OperationCanceledExceptionOccurs when cancellation has been requested.

See Also