Class DataCommandBase<TOperationContext, TResult>
Base implementation of a data command.
Inheritance
Inherited Members
Namespace: Kephas.Data.Commands
Assembly: Kephas.Data.dll
Syntax
public abstract class DataCommandBase<TOperationContext, TResult> : Loggable, ILoggable, IDataCommand<TOperationContext, TResult>, IDataCommand, IAsyncOperation where TOperationContext : IDataOperationContext where TResult : IDataCommandResult
Type Parameters
| Name | Description |
|---|---|
| TOperationContext | Type of the operationContext. |
| TResult | Type of the result. |
Methods
| Improve this Doc View SourceExecuteAsync(TOperationContext, CancellationToken)
Executes the data command asynchronously.
Declaration
public abstract Task<TResult> ExecuteAsync(TOperationContext operationContext, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| TOperationContext | operationContext | The operation context. |
| System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<TResult> | A promise of a IDataCommandResult. |
GetIdEqualityExpression<T>(IDataContext, Object)
Gets the equality expression for of: t => t.Id == entityEntry.Id.
Declaration
protected virtual Expression<Func<T, bool>> GetIdEqualityExpression<T>(IDataContext dataContext, object entityId)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataContext | dataContext | Context for the data. |
| System.Object | entityId | The entity ID. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> | The equality expression. |
Type Parameters
| Name | Description |
|---|---|
| T | The entity type. |
TryGetEntityActivator(IDataContext)
Tries to get the data context's entity activator.
Declaration
protected virtual IActivator TryGetEntityActivator(IDataContext dataContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataContext | dataContext | Context for the data. |
Returns
| Type | Description |
|---|---|
| IActivator | An IActivator. |
TryGetLocalCache(IDataContext)
Tries to get the data context's local cache.
Declaration
protected virtual IDataContextCache TryGetLocalCache(IDataContext dataContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataContext | dataContext | Context for the data. |
Returns
| Type | Description |
|---|---|
| IDataContextCache | An IDataContextCache. |
Explicit Interface Implementations
| Improve this Doc View SourceIDataCommand.ExecuteAsync(IDataOperationContext, CancellationToken)
Executes the data command asynchronously.
Declaration
Task<IDataCommandResult> IDataCommand.ExecuteAsync(IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataOperationContext | operationContext | The operation context. |
| System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IDataCommandResult> | A promise of a IDataCommandResult. |
IAsyncOperation.ExecuteAsync(IContext, CancellationToken)
Executes the asynchronous operation.
Declaration
Task<object> IAsyncOperation.ExecuteAsync(IContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| IContext | context | Optional. The context. |
| System.Threading.CancellationToken | cancellationToken | Optional. The cancellation token (optional). |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Object> | An asynchronous result. |
Exceptions
| Type | Condition |
|---|---|
| DataException | Thrown when a Data error condition occurs. |