Class FindCommandBase<TFindContext>
Base class for find commands.
Inherited Members
Namespace: Kephas.Data.Commands
Assembly: Kephas.Data.dll
Syntax
public abstract class FindCommandBase<TFindContext> : DataCommandBase<TFindContext, IFindResult>, ILoggable, IDataCommand<TFindContext, IFindResult>, IDataCommand, IAsyncOperation where TFindContext : class, IFindContextBase
Type Parameters
| Name | Description |
|---|---|
| TFindContext | Type of the find context. |
Methods
| Improve this Doc View SourceExecuteAsync(TFindContext, CancellationToken)
Executes the data command asynchronously.
Declaration
public override Task<IFindResult> ExecuteAsync(TFindContext operationContext, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| TFindContext | operationContext | The operation context. |
| System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IFindResult> | A promise of a IDataCommandResult. |
Overrides
FindAsync<T>(TFindContext, CancellationToken)
Searches for the first entity matching the provided criteria and returns it asynchronously.
Declaration
protected virtual Task<IFindResult> FindAsync<T>(TFindContext findContext, CancellationToken cancellationToken)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| TFindContext | findContext | The find context. |
| System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IFindResult> | A promise of the found entity. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the entity. |
GetCriteriaString<T>(TFindContext, Expression<Func<T, Boolean>>)
Gets the criteria string for exception display.
Declaration
protected virtual string GetCriteriaString<T>(TFindContext findContext, Expression<Func<T, bool>> criteria)
Parameters
| Type | Name | Description |
|---|---|---|
| TFindContext | findContext | The find context. |
| System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> | criteria | The criteria. |
Returns
| Type | Description |
|---|---|
| System.String | The criteria string. |
Type Parameters
| Name | Description |
|---|---|
| T | The entity type. |
GetFindCriteria<T>(TFindContext)
Gets the find criteria.
Declaration
protected abstract Expression<Func<T, bool>> GetFindCriteria<T>(TFindContext findContext)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| TFindContext | findContext | The find context. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> | The find criteria. |
Type Parameters
| Name | Description |
|---|---|
| T | The entity type. |
GetFindResult<T>(TFindContext, IList<T>, Expression<Func<T, Boolean>>)
Gets the find result out of the results.
Declaration
protected virtual IFindResult GetFindResult<T>(TFindContext findContext, IList<T> result, Expression<Func<T, bool>> criteria)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| TFindContext | findContext | The find context. |
| System.Collections.Generic.IList<T> | result | The result. |
| System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> | criteria | The criteria. |
Returns
| Type | Description |
|---|---|
| IFindResult | The find result. |
Type Parameters
| Name | Description |
|---|---|
| T | The entity type. |
TryGetLocalCacheQuery<T>(TFindContext)
Tries to get a query over the local cache entities of a particular type.
Declaration
protected virtual IEnumerable<T> TryGetLocalCacheQuery<T>(TFindContext findContext)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| TFindContext | findContext | The find context. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T> | A query of local cache entities. |
Type Parameters
| Name | Description |
|---|---|
| T | The entity type. |