Show / Hide Table of Contents

Class AppBase

Base class for the application's root.

Inheritance
System.Object
AppBase
StartupBase
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Application
Assembly: Kephas.Application.dll
Syntax
public abstract class AppBase
Remarks

You should inherit this class and override at least the ConfigureAmbientServices(IAmbientServices) method.

Constructors

| Improve this Doc View Source

AppBase(IAmbientServices)

Initializes a new instance of the AppBase class.

Declaration
protected AppBase(IAmbientServices ambientServices = null)
Parameters
Type Name Description
IAmbientServices ambientServices

Optional. The ambient services. If not provided then Instance is considered.

Properties

| Improve this Doc View Source

AmbientServices

Gets the ambient services.

Declaration
public IAmbientServices AmbientServices { get; }
Property Value
Type Description
IAmbientServices

The ambient services.

| Improve this Doc View Source

AppContext

Gets a context for the application.

Declaration
public IAppContext AppContext { get; }
Property Value
Type Description
IAppContext

The application context.

| Improve this Doc View Source

Logger

Gets or sets the logger.

Declaration
protected ILogger Logger { get; set; }
Property Value
Type Description
ILogger

The logger.

Methods

| Improve this Doc View Source

BootstrapAsync(String[], CancellationToken)

Bootstraps the application asynchronously.

Declaration
public virtual Task<(IAppContext appContext, AppShutdownInstruction instruction)> BootstrapAsync(string[] rawAppArgs = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String[] rawAppArgs

Optional. The application arguments.

System.Threading.CancellationToken cancellationToken

Optional. The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.ValueTuple<IAppContext, AppShutdownInstruction>>

The asynchronous result that yields the IAppContext.

| Improve this Doc View Source

ConfigureAmbientServices(IAmbientServices)

Configures the ambient services asynchronously.

Declaration
protected abstract void ConfigureAmbientServices(IAmbientServices ambientServices)
Parameters
Type Name Description
IAmbientServices ambientServices

The ambient services.

Remarks

Override this method to initialize the startup services, like log manager and configuration manager.

| Improve this Doc View Source

CreateAppContext(IAmbientServices)

Creates the application context.

Declaration
protected virtual IAppContext CreateAppContext(IAmbientServices ambientServices)
Parameters
Type Name Description
IAmbientServices ambientServices

The ambient services.

Returns
Type Description
IAppContext

The new application context.

| Improve this Doc View Source

FinalizeAppManagerAsync(CancellationToken)

Finalizes the application manager asynchronously.

Declaration
protected virtual Task<IAppContext> FinalizeAppManagerAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<IAppContext>

A promise of the IAppContext.

| Improve this Doc View Source

InitializeAppManagerAsync(IAppContext, CancellationToken)

Initializes the application manager asynchronously.

Declaration
protected virtual Task<IAppContext> InitializeAppManagerAsync(IAppContext appContext, CancellationToken cancellationToken)
Parameters
Type Name Description
IAppContext appContext

Context for the application.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<IAppContext>

A promise of the IAppContext.

| Improve this Doc View Source

InitializePrerequisites(String[])

Initializes the application prerequisites: the ambient services, the application context registration, the logger, other.

Declaration
protected virtual bool InitializePrerequisites(string[] rawAppArgs)
Parameters
Type Name Description
System.String[] rawAppArgs

The application arguments.

Returns
Type Description
System.Boolean

True if the initialization was performed, false if it was ignored because of subsequent calls.

| Improve this Doc View Source

Log(LogLevel, Exception, String, Object[])

Logs the provided information.

Declaration
protected virtual void Log(LogLevel level, Exception exception, string messageFormat = null, params object[] args)
Parameters
Type Name Description
LogLevel level

The level.

System.Exception exception

The exception.

System.String messageFormat

The message format.

System.Object[] args

The arguments.

| Improve this Doc View Source

OnCurrentDomainUnhandledException(Object, UnhandledExceptionEventArgs)

Handles the unhandled exception event.

Declaration
protected virtual void OnCurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
Parameters
Type Name Description
System.Object sender

Source of the event.

System.UnhandledExceptionEventArgs e

Event information to send to registered event handlers.

| Improve this Doc View Source

ShutdownAsync(CancellationToken)

Shuts down the application asynchronously.

Declaration
public virtual Task<IAppContext> ShutdownAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

Optional. The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<IAppContext>

A promise of the IAppContext.

| Improve this Doc View Source

WaitForShutdownSignalAsync(CancellationToken)

Waits for the shutdown signal asynchronously.

Declaration
protected virtual Task<AppShutdownInstruction> WaitForShutdownSignalAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

Optional. The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<AppShutdownInstruction>

An asynchronous result that yields the shutdown instruction.

Extension Methods

DynamicObjectExtensions.SetPropertyValue(Object, String, Object)
DynamicObjectExtensions.TrySetPropertyValue(Object, String, Object)
DynamicObjectExtensions.GetPropertyValue(Object, String)
DynamicObjectExtensions.TryGetPropertyValue(Object, String, out Object)
DynamicObjectExtensions.GetRuntimeTypeInfo(Object)
DynamicObjectExtensions.ToDynamic(Object)
DynamicObjectExtensions.ToExpando(Object)
BehaviorValue.ToBehaviorValue<TValue>(TValue)
CollectionExtensions.AddRange<T, TItem>(T, IEnumerable<TItem>)
LoggingExtensions.GetLogger(Object, IContext)
TypeExtensions.GetAbstractType(Object)
TypeExtensions.GetAbstractTypeInfo(Object)
ReflectionHelper.GetTypeInfo(Object)
EntityEntryExtensions.TryGetAttachedEntityEntry(Object)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX