Class ConsoleProgram<TApp>
Console program with http client and
Implements
Inherited Members
Namespace: PayrollEngine.Client
Assembly: PayrollEngine.Client.Core.dll
Syntax
public abstract class ConsoleProgram<TApp> : ConsoleToolBase, IDisposable where TApp : class
Type Parameters
| Name | Description |
|---|---|
| TApp |
Constructors
ConsoleProgram(ProgramConfigurationOptions)
The console program constructor
Declaration
protected ConsoleProgram(ProgramConfigurationOptions configurationOptions = ProgramConfigurationOptions.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| ProgramConfigurationOptions | configurationOptions | The program configuration options |
Properties
Configuration
The program configuration
Declaration
protected ProgramConfiguration<TApp> Configuration { get; }
Property Value
| Type | Description |
|---|---|
| ProgramConfiguration<TApp> |
DefaultCultureName
The default culture name
Declaration
protected virtual string DefaultCultureName { get; }
Property Value
| Type | Description |
|---|---|
| string |
HttpClient
The payroll http client
Declaration
protected PayrollHttpClient HttpClient { get; }
Property Value
| Type | Description |
|---|---|
| PayrollHttpClient |
LogErrors
Log the errors, default is true
Declaration
protected virtual bool LogErrors { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LogLifecycle
Log thr program lifecycle, default is true
Declaration
protected virtual bool LogLifecycle { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MandatoryArgumentCount
Count of mandatory arguments, default is 0
Declaration
protected virtual int MandatoryArgumentCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
ShowConnectionInfo
Show the connection status, default is true
Declaration
protected virtual bool ShowConnectionInfo { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ShowErrorExitCode
Use program exit code, default is true
Declaration
protected virtual bool ShowErrorExitCode { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ShowProgramTitle
Show the program title, default is true
Declaration
protected virtual bool ShowProgramTitle { get; }
Property Value
| Type | Description |
|---|---|
| bool |
UseHelpArgument
Show the connection status, default is true
Declaration
protected virtual bool UseHelpArgument { get; }
Property Value
| Type | Description |
|---|---|
| bool |
WaitOnError
Use error confirmation, default is true
Declaration
protected virtual bool WaitOnError { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Dispose()
Program dispose
Declaration
public void Dispose()
ExecuteAsync()
Execute the program
Declaration
public virtual Task ExecuteAsync()
Returns
| Type | Description |
|---|---|
| Task |
FullErrorLog()
Show full error log (default: false)
Declaration
protected virtual bool FullErrorLog()
Returns
| Type | Description |
|---|---|
| bool |
GetHttpClientHandlerAsync()
Get the http client handler, by default always a valid server certificate
Declaration
protected virtual Task<HttpClientHandler> GetHttpClientHandlerAsync()
Returns
| Type | Description |
|---|---|
| Task<HttpClientHandler> |
GetHttpConfigurationAsync()
Get the http configuration
Declaration
protected virtual Task<PayrollHttpConfiguration> GetHttpConfigurationAsync()
Returns
| Type | Description |
|---|---|
| Task<PayrollHttpConfiguration> |
Remarks
This request ignores the web host variable
GetProgramCopyright()
Get the program copyright
Declaration
protected virtual string GetProgramCopyright()
Returns
| Type | Description |
|---|---|
| string |
GetProgramCultureAsync()
Program culture setup
Declaration
protected virtual Task<string> GetProgramCultureAsync()
Returns
| Type | Description |
|---|---|
| Task<string> |
GetProgramTitle()
Get the program title
Declaration
protected virtual string GetProgramTitle()
Returns
| Type | Description |
|---|---|
| string |
GetProgramVersion()
Get the program version
Declaration
protected virtual string GetProgramVersion()
Returns
| Type | Description |
|---|---|
| string |
HelpAsync()
Show the program help
Declaration
protected virtual Task HelpAsync()
Returns
| Type | Description |
|---|---|
| Task |
InitializeAsync()
Initialize the console program
Declaration
protected virtual Task<bool> InitializeAsync()
Returns
| Type | Description |
|---|---|
| Task<bool> | True for valid program start state |
NotifyConnectionErrorAsync()
Connection error handler
Declaration
protected virtual Task NotifyConnectionErrorAsync()
Returns
| Type | Description |
|---|---|
| Task |
NotifyErrorAsync(Exception)
Notify error
Declaration
protected virtual Task NotifyErrorAsync(Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The error exception |
Returns
| Type | Description |
|---|---|
| Task |
NotifyErrorAsync(string)
Show error
Declaration
protected virtual Task NotifyErrorAsync(string error)
Parameters
| Type | Name | Description |
|---|---|---|
| string | error | The error message |
Returns
| Type | Description |
|---|---|
| Task |
NotifyGlobalErrorAsync(Exception)
Notify global error
Declaration
protected virtual Task NotifyGlobalErrorAsync(Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The error exception |
Returns
| Type | Description |
|---|---|
| Task |
OnInvalidHttpConfiguration(PayrollHttpConfiguration)
Handler on invalid http configuration
Declaration
protected virtual void OnInvalidHttpConfiguration(PayrollHttpConfiguration _)
Parameters
| Type | Name | Description |
|---|---|---|
| PayrollHttpConfiguration | _ |
OnMissingHttpConfiguration()
Handler on missing http configuration
Declaration
protected virtual void OnMissingHttpConfiguration()
RunAsync()
Run the program
Declaration
protected abstract Task RunAsync()
Returns
| Type | Description |
|---|---|
| Task |
SetupHttpClientAsync()
Http client setup
Declaration
protected virtual Task<bool> SetupHttpClientAsync()
Returns
| Type | Description |
|---|---|
| Task<bool> |
SetupLogAsync()
Initialize the console program
Declaration
protected virtual Task SetupLogAsync()
Returns
| Type | Description |
|---|---|
| Task |
ShowTitleAsync()
Show the program title
Declaration
protected virtual Task ShowTitleAsync()
Returns
| Type | Description |
|---|---|
| Task |
ShutdownAsync()
Shutdown the program
Declaration
protected virtual Task ShutdownAsync()
Returns
| Type | Description |
|---|---|
| Task |
UseHttpClient()
Use the payroll http client, default is true
Declaration
protected virtual bool UseHttpClient()
Returns
| Type | Description |
|---|---|
| bool |