Interface IApplication
Establishes a general model for applications - a "chassis": root service composite governs app initialization, module linking (service location), state management, logging, security, and other app/process-wide activities. An applications is usually allocated at program entry point and provides common "ambient" context - a "chassis pattern".
Inherited Members
Namespace: Azos
Assembly: Azos.dll
Syntax
public interface IApplication : INamed, ILocalizedTimeProvider
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. Used to exit background workers gracefully (e.g. reactor completion threads, abort pending tasks etc.)
Declaration
bool Active { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
AllComponents
Returns all components that this application contains
Declaration
IEnumerable<IApplicationComponent> AllComponents { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IApplicationComponent> |
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 launch 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 |
DependencyInjector
References application dependency injector which injects app-context rooted dependencies into objects. The frameworks calls this service automatically for most places (Mvc models/views/controllers, Glue servers) so business application developers should rarely (if ever) use this facility
Declaration
IApplicationDependencyInjector DependencyInjector { get; }
Property Value
Type | Description |
---|---|
IApplicationDependencyInjector |
EnvironmentName
Provides access to "environment-name" attribute, e.g. "DEV" vs "PROD"
Declaration
string EnvironmentName { get; }
Property Value
Type | Description |
---|---|
System.String |
EventTimer
References event timer - an entity that maintains and runs scheduled instances of Event class
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. This is used in server applications
Declaration
bool ForceInvariantCulture { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Glue
References glue implementation that is used to "glue" remote instances/processes/contracts together (IPC)
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 constructs should not form special cases just for unit testing, however in some cases this flag is useful. It is not exposed via App. static accessors
Declaration
bool IsUnitTest { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Log
References app primary logging facility
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 |
Random
Returns random generator used by the application
Declaration
RandomGenerator Random { get; }
Property Value
Type | Description |
---|---|
RandomGenerator |
Realm
References an accessor to the application surrounding environment (realm) in which app gets executed. This realm is sub-divided into uniquely-named areas each reporting their status. This is used by various app components and services to assess the environment status in which they execute, for example: a logger may suppress error messages from network in a cluster when the area is about to be upgraded to new software. One may consider this status as a "message board" where services/system check/report the planned or unexpected outages and adjust their behavior accordingly. Azos provides only the base implementation of such classes delegating the specifics to more concrete app containers.
Declaration
IApplicationRealm Realm { get; }
Property Value
Type | Description |
---|---|
IApplicationRealm |
SecurityManager
References security manager that performs user authentication based on passed credentials and other security-related general 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 |
Singletons
Manages singleton instances per application
Declaration
IApplicationSingletonManager Singletons { get; }
Property Value
Type | Description |
---|---|
IApplicationSingletonManager |
StartTime
Returns time stamp 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
GetComponentByCommonName(String)
Returns an existing application component instance by its ComponentCommonName or null. The search is case-insensitive
Declaration
IApplicationComponent GetComponentByCommonName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
IApplicationComponent |
GetComponentBySID(UInt64)
Returns a component by SID or null
Declaration
IApplicationComponent GetComponentBySID(ulong sid)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | sid |
Returns
Type | Description |
---|---|
IApplicationComponent |
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 life cycle.
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 workers may start to complete
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 |