Table of Contents

Class CollectionCommand<TEntity, TEndpoint, TElementEndpoint, TElementCommand>

Namespace
TypedRest.CommandLine.Commands.Generic
Assembly
TypedRest.CommandLine.dll
public abstract class CollectionCommand<TEntity, TEndpoint, TElementEndpoint, TElementCommand> : IndexerCommand<TEndpoint, TElementEndpoint, TElementCommand>, IEndpointCommand where TEntity : class where TEndpoint : ICollectionEndpoint<TEntity, TElementEndpoint> where TElementEndpoint : IElementEndpoint<TEntity> where TElementCommand : IEndpointCommand

Type Parameters

TEntity

The type of entity the endpoint represents.

TEndpoint

The specific type of ICollectionEndpoint<TEntity, TElementEndpoint> to operate on.

TElementEndpoint

The specific type of IElementEndpoint<TEntity> the TEndpoint provides for individual TEntitys.

TElementCommand

The specific type of IEndpointCommand is used to handle TElementEndpoints. Must have a public constructor with a TElementEndpoint parameter.

Inheritance
EndpointCommand<TEndpoint>
IndexerCommand<TEndpoint, TElementEndpoint, TElementCommand>
CollectionCommand<TEntity, TEndpoint, TElementEndpoint, TElementCommand>
Implements
Derived
Inherited Members

Constructors

CollectionCommand(TEndpoint)

protected CollectionCommand(TEndpoint endpoint)

Parameters

endpoint TEndpoint

The endpoint this command operates on.

Methods

ExecuteAsync(IReadOnlyList<string>, CancellationToken)

Parses command-line arguments and executes the resulting operation.

public override Task ExecuteAsync(IReadOnlyList<string> args, CancellationToken cancellationToken = default)

Parameters

args IReadOnlyList<string>

the console arguments.

cancellationToken CancellationToken

Used to cancel the request.

Returns

Task

InputEntities(IReadOnlyList<string>)

Acquires a TEntity from the user, e.g. by parsing the args or via JSON on the console.

protected virtual IEnumerable<TEntity> InputEntities(IReadOnlyList<string> args)

Parameters

args IReadOnlyList<string>

Returns

IEnumerable<TEntity>

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

OutputEntities(IEnumerable<TEntity>)

Outputs a collection of TEntitys to the user, e.g., via ToString() on the console.

protected virtual void OutputEntities(IEnumerable<TEntity> entities)

Parameters

entities IEnumerable<TEntity>