Class StreamPrinter<TEntity>
- Namespace
- TypedRest.CommandLine.IO
- Assembly
- TypedRest.CommandLine.dll
Prints a stream of TEntitys to an IConsole.
public class StreamPrinter<TEntity> : IObserver<TEntity>
Type Parameters
TEntity
- Inheritance
-
objectStreamPrinter<TEntity>
- Implements
-
IObserver<TEntity>
Constructors
StreamPrinter(IConsole)
Prints a stream of TEntitys to an IConsole.
public StreamPrinter(IConsole console)
Parameters
consoleIConsoleThe console to print to.
Methods
OnCompleted()
public void OnCompleted()
OnError(Exception)
Reprots an error to the user via the console.
public virtual void OnError(Exception error)
Parameters
errorException
OnNext(TEntity)
Outputs a TEntity to the user via the console.
public virtual void OnNext(TEntity value)
Parameters
valueTEntity
PrintAsync(IObservable<TEntity>, CancellationToken)
Prints all entities provided by the observable to the JsonConsole.
public Task PrintAsync(IObservable<TEntity> observable, CancellationToken cancellationToken)
Parameters
observableIObservable<TEntity>cancellationTokenCancellationToken
Returns
Remarks
This method is only intended to be called once per class instance.