Class AppHostBase
Represents the base class of the host application.
Inherited Members
Namespace: Solti.Utils.Rpc.Hosting
Assembly: Solti.Utils.Rpc.Server.dll
Syntax
public abstract class AppHostBase : CommandLineApplication
Constructors
AppHostBase(IReadOnlyList<String>)
Creates a new AppHostBase instance.
Declaration
protected AppHostBase(IReadOnlyList<string> args)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<String> | args |
Properties
DiProvider
The DI backend.
Declaration
public IDiProvider DiProvider { get; set; }
Property Value
Type | Description |
---|---|
IDiProvider |
Remarks
This property can be set in initialization time only.
WebService
Returns the underlying WebService.
Declaration
public WebService WebService { get; }
Property Value
Type | Description |
---|---|
WebService |
Remarks
This property is set only once, after successful service configuration.
Methods
CreateServiceBuilder()
Creates a new WebServiceBuilder instance.
Declaration
protected virtual WebServiceBuilder CreateServiceBuilder()
Returns
Type | Description |
---|---|
WebServiceBuilder |
Remarks
Override this method if you want to use your own builder.
InvokeInScope(Action<IInjector>)
Invokes an action in a separate scope.
Declaration
protected void InvokeInScope(Action<IInjector> invocation)
Parameters
Type | Name | Description |
---|---|---|
Action<Solti.Utils.DI.Interfaces.IInjector> | invocation |
OnBuilt()
Called once when the WebService is built successfully.
Declaration
public virtual void OnBuilt()
Remarks
Override this method if you need to implement one-time initialization logic that depends on the built service.
OnConfigure(WebServiceBuilder)
Invoked once on configuration phase.
Declaration
public abstract void OnConfigure(WebServiceBuilder serviceBuilder)
Parameters
Type | Name | Description |
---|---|---|
WebServiceBuilder | serviceBuilder |
Remarks
Override this method to configure the RPC service being built.
OnConfigureServices(IServiceCollection)
Invoked once on configuration phase.
Declaration
public virtual void OnConfigureServices(IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
Solti.Utils.DI.Interfaces.IServiceCollection | services |
Remarks
The primary place to configure services is the OnConfigure(WebServiceBuilder) method (using the ConfigureServices(Action<IServiceCollection>)). Override this method only if you need scoped installation logic (OnInstall(IInjector) or OnUnInstall(IInjector)).
OnConfigureWin32Service(Win32ServiceDescriptor)
Called on service install/uninstall ("YouApp.exe service [un]install").
Declaration
public virtual void OnConfigureWin32Service(Win32ServiceDescriptor descriptor)
Parameters
Type | Name | Description |
---|---|---|
Win32ServiceDescriptor | descriptor |
Remarks
Put Win32 Service configuration related stuffs here. App installation logic should be placed in the OnInstall() and OnUnInstall() methods.
OnInstall()
Called on app install ("YouApp.exe [service] install").
Declaration
[Verb("install")]
public virtual void OnInstall()
Remarks
Override this method to implement app specific installation logic.
OnInstall(IInjector)
Called on app install ("YouApp.exe [service] install").
Declaration
public virtual void OnInstall(IInjector scope)
Parameters
Type | Name | Description |
---|---|---|
Solti.Utils.DI.Interfaces.IInjector | scope |
Remarks
Override this method to implement app specific installation logic.
OnRun()
Starts the host as a command line application
Declaration
public override void OnRun()
Overrides
Remarks
In most of cases you should not override this method.
OnStart()
Called on host start
Declaration
public virtual void OnStart()
Remarks
In most of cases you should not override this method. To configure your service instance use the OnConfigure(WebServiceBuilder) and OnBuilt() methods.
OnStop()
Called on host termination
Declaration
public virtual void OnStop()
Remarks
Override this method if you need to do some resource cleanup.
OnUnInstall()
Called on app uninstall ("YouApp.exe [service] uninstall").
Declaration
[Verb("uninstall")]
public virtual void OnUnInstall()
Remarks
Override this method to implement app specific uninstallation logic.
OnUnInstall(IInjector)
Called on app uninstall ("YouApp.exe [service] uninstall").
Declaration
public virtual void OnUnInstall(IInjector scope)
Parameters
Type | Name | Description |
---|---|---|
Solti.Utils.DI.Interfaces.IInjector | scope |
Remarks
Override this method to implement app specific uninstallation logic.