Class ElementCommand<TEntity>
- Namespace
- TypedRest.CommandLine.Commands.Generic
- Assembly
- TypedRest.CommandLine.dll
Command operating on an IElementEndpoint<TEntity>.
public class ElementCommand<TEntity> : EndpointCommand<IElementEndpoint<TEntity>>, IEndpointCommand where TEntity : class
Type Parameters
TEntity
The type of entity the endpoint represents.
- Inheritance
-
EndpointCommand<IElementEndpoint<TEntity>>ElementCommand<TEntity>
- Implements
- Derived
- Inherited Members
Constructors
ElementCommand(IElementEndpoint<TEntity>)
Command operating on an IElementEndpoint<TEntity>.
public ElementCommand(IElementEndpoint<TEntity> endpoint)
Parameters
endpoint
IElementEndpoint<TEntity>The endpoint this command operates on.
Methods
ExecuteInnerAsync(IReadOnlyList<string>, CancellationToken)
Parses command-line arguments and executes the resulting operation when no additional sub-IEndpointCommand is specified.
protected override Task ExecuteInnerAsync(IReadOnlyList<string> args, CancellationToken cancellationToken = default)
Parameters
args
IReadOnlyList<string>the console arguments.
cancellationToken
CancellationTokenUsed to cancel the request.
Returns
InputEntity(IReadOnlyList<string>)
Acquires a TEntity
from the user, e.g. by parsing the args
or via JSON on the console.
protected virtual TEntity InputEntity(IReadOnlyList<string> args)
Parameters
args
IReadOnlyList<string>
Returns
- TEntity
OutputEntity(TEntity)
Outputs a TEntity
to the user via the console.
protected virtual void OutputEntity(TEntity entity)
Parameters
entity
TEntity