Show / Hide Table of Contents

Interface IApplication

Describes general application model - usually a root service locator with dependency injection container that governs application initialization, state management, logging etc. An applications is usually implemented with a singleton class that has static conduits to instance properties via App shortcut. Application instances may get passed by reference to simplify mocking

Inherited Members
INamed.Name
ILocalizedTimeProvider.TimeLocation
ILocalizedTimeProvider.LocalizedTime
ILocalizedTimeProvider.UniversalTimeToLocalizedTime(DateTime)
ILocalizedTimeProvider.LocalizedTimeToUniversalTime(DateTime)
Namespace: NFX.ApplicationModel
Assembly: NFX.dll
Syntax
public interface IApplication : INamed, ILocalizedTimeProvider
Remarks

This pattern is used on purpose based on careful evaluation of various DI frameworks use-cases in various projects, both server and client-side. The central service/locator hub per process as faciliatetd by the IApplication is the most intuitive and simple dependency resolution facility for 90+% of various business applications - it significantly simplifies development and debugging as Application provides a common root for all ApplicationComponents regardless of the app types

Properties

Active

Returns true when application instance is active and working. This property returns false as soon as application finalization starts on shutdown or Stop() was called Use to exit long-running loops and such

Declaration
bool Active { get; }
Property Value
Type Description
System.Boolean

AllowNesting

Returns true when this app container allows nesting of another one

Declaration
bool AllowNesting { get; }
Property Value
Type Description
System.Boolean

CommandArgs

References application command arguments

Declaration
IConfigSectionNode CommandArgs { get; }
Property Value
Type Description
IConfigSectionNode

ConfigRoot

References application configuration root

Declaration
IConfigSectionNode ConfigRoot { get; }
Property Value
Type Description
IConfigSectionNode

DataStore

References application data store

Declaration
IDataStore DataStore { get; }
Property Value
Type Description
IDataStore

EventTimer

References event timer - an entity that maintains and runs scheduled instances of Event

Declaration
IEventTimer EventTimer { get; }
Property Value
Type Description
IEventTimer

ForceInvariantCulture

True when the app should force the process-wide invariant culture regardless of machine-level culture

Declaration
bool ForceInvariantCulture { get; }
Property Value
Type Description
System.Boolean

Glue

References glue implementation that may be used to "glue" remote instances/processes/contracts together

Declaration
IGlue Glue { get; }
Property Value
Type Description
IGlue

InstanceID

Returns unique identifier of this running instance

Declaration
Guid InstanceID { get; }
Property Value
Type Description
System.Guid

Instrumentation

References instrumentation for this application instance

Declaration
IInstrumentation Instrumentation { get; }
Property Value
Type Description
IInstrumentation

IsUnitTest

True if app is launched as a unit test as set by the app config "unit-test=true" The general use of this flag is discouraged as code cnstructs should not form special cases just for unit testing, however in some cases this flag is usefull. It is not exposed via App. static accessors

Declaration
bool IsUnitTest { get; }
Property Value
Type Description
System.Boolean

Log

References app log

Declaration
ILog Log { get; }
Property Value
Type Description
ILog

ModuleRoot

References the root module (such as business domain logic) for this application. This is a dependency injection root provided for any application type

Declaration
IModule ModuleRoot { get; }
Property Value
Type Description
IModule

ObjectStore

References object store that may be used to persist object graphs between volatile application shutdown cycles

Declaration
IObjectStore ObjectStore { get; }
Property Value
Type Description
IObjectStore

SecurityManager

References security manager that performs user authentication based on passed credentials and other security-related global tasks

Declaration
ISecurityManager SecurityManager { get; }
Property Value
Type Description
ISecurityManager

ShutdownStarted

Returns true after Dispose() was called to indicate that application is shutting down

Declaration
bool ShutdownStarted { get; }
Property Value
Type Description
System.Boolean

StartTime

Returns timestamp when application started as localized app time

Declaration
DateTime StartTime { get; }
Property Value
Type Description
System.DateTime

Stopping

Returns true after Stop() was called

Declaration
bool Stopping { get; }
Property Value
Type Description
System.Boolean

TimeSource

References time source - an entity that supplies local and UTC times. The concrete implementation may elect to get accurate times from the network or other external precision time sources (i.e. NASA atomic clock)

Declaration
ITimeSource TimeSource { get; }
Property Value
Type Description
ITimeSource

Methods

MakeNewSessionInstance(Guid, User)

Factory method that creates new session object suitable for particular application type

Declaration
ISession MakeNewSessionInstance(Guid sessionID, User user = null)
Parameters
Type Name Description
System.Guid sessionID

Session identifier

User user

Optional user object that the session is for

Returns
Type Description
ISession

New session object

NotifyAllConfigSettingsAboutChange()

Forces notification of all registered IConfigSettings-implementers about configuration change

Declaration
void NotifyAllConfigSettingsAboutChange()

RegisterAppFinishNotifiable(IApplicationFinishNotifiable)

Registers an instance of IApplicationFinishNotifiable with application container to receive a call when underlying application instance will finish its lifecycle.

Declaration
bool RegisterAppFinishNotifiable(IApplicationFinishNotifiable notifiable)
Parameters
Type Name Description
IApplicationFinishNotifiable notifiable
Returns
Type Description
System.Boolean

True if notifiable instance was not found and was added

RegisterConfigSettings(IConfigSettings)

Registers an instance of IConfigSettings with application container to receive a call when underlying app configuration changes

Declaration
bool RegisterConfigSettings(IConfigSettings settings)
Parameters
Type Name Description
IConfigSettings settings
Returns
Type Description
System.Boolean

True if settings instance was not found and was added

Stop()

Initiates the stop of the application by setting its Stopping to true and Active to false so dependent services may start to terminate

Declaration
void Stop()

UnregisterAppFinishNotifiable(IApplicationFinishNotifiable)

Removes the registration of IApplicationFinishNotifiable from application container

Declaration
bool UnregisterAppFinishNotifiable(IApplicationFinishNotifiable notifiable)
Parameters
Type Name Description
IApplicationFinishNotifiable notifiable
Returns
Type Description
System.Boolean

True if notifiable instance was found and removed

UnregisterConfigSettings(IConfigSettings)

Removes the registration of IConfigSettings from application container

Declaration
bool UnregisterConfigSettings(IConfigSettings settings)
Parameters
Type Name Description
IConfigSettings settings
Returns
Type Description
System.Boolean

True if settings instance was found and removed

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX