Class CommonApplicationLogic
Provides base implementation of IApplication for various application kinds
Inheritance
System.Object
CommonApplicationLogic
Implements
System.IDisposable
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()
Assembly: NFX.dll
Syntax
[ConfigMacroContext]
public abstract class CommonApplicationLogic : DisposableObject, IDisposable, IApplication, INamed, ILocalizedTimeProvider
Constructors
CommonApplicationLogic(Boolean, Configuration, ConfigSectionNode)
Declaration
protected CommonApplicationLogic(bool allowNesting, Configuration cmdLineArgs, ConfigSectionNode rootConfig)
Parameters
Fields
CONFIG_APP_NAME_ATTR
Declaration
public const string CONFIG_APP_NAME_ATTR = "application-name"
Field Value
Type |
Description |
System.String |
|
CONFIG_ASSEMBLY_SECTION
Declaration
public const string CONFIG_ASSEMBLY_SECTION = "assembly"
Field Value
Type |
Description |
System.String |
|
CONFIG_DATA_STORE_SECTION
Declaration
public const string CONFIG_DATA_STORE_SECTION = "data-store"
Field Value
Type |
Description |
System.String |
|
CONFIG_ENABLED_ATTR
Declaration
public const string CONFIG_ENABLED_ATTR = "enabled"
Field Value
Type |
Description |
System.String |
|
CONFIG_EVENT_TIMER_SECTION
Declaration
public const string CONFIG_EVENT_TIMER_SECTION = "event-timer"
Field Value
Type |
Description |
System.String |
|
CONFIG_FORCE_INVARIANT_CULTURE_ATTR
Declaration
public const string CONFIG_FORCE_INVARIANT_CULTURE_ATTR = "force-invariant-culture"
Field Value
Type |
Description |
System.String |
|
CONFIG_GLUE_SECTION
Declaration
public const string CONFIG_GLUE_SECTION = "glue"
Field Value
Type |
Description |
System.String |
|
CONFIG_INSTRUMENTATION_SECTION
Declaration
public const string CONFIG_INSTRUMENTATION_SECTION = "instrumentation"
Field Value
Type |
Description |
System.String |
|
CONFIG_LOG_SECTION
Declaration
public const string CONFIG_LOG_SECTION = "log"
Field Value
Type |
Description |
System.String |
|
CONFIG_MEMORY_MANAGEMENT_SECTION
Declaration
public const string CONFIG_MEMORY_MANAGEMENT_SECTION = "memory-management"
Field Value
Type |
Description |
System.String |
|
CONFIG_MODULE_SECTION
Declaration
public const string CONFIG_MODULE_SECTION = "module"
Field Value
Type |
Description |
System.String |
|
CONFIG_MODULES_SECTION
Declaration
public const string CONFIG_MODULES_SECTION = "modules"
Field Value
Type |
Description |
System.String |
|
CONFIG_OBJECT_STORE_SECTION
Declaration
public const string CONFIG_OBJECT_STORE_SECTION = "object-store"
Field Value
Type |
Description |
System.String |
|
CONFIG_PATH_ATTR
Declaration
public const string CONFIG_PATH_ATTR = "path"
Field Value
Type |
Description |
System.String |
|
CONFIG_PRELOAD_ASSEMBLIES_SECTION
Declaration
public const string CONFIG_PRELOAD_ASSEMBLIES_SECTION = "preload-assemblies"
Field Value
Type |
Description |
System.String |
|
CONFIG_SECURITY_SECTION
Declaration
public const string CONFIG_SECURITY_SECTION = "security"
Field Value
Type |
Description |
System.String |
|
CONFIG_STARTER_SECTION
Declaration
public const string CONFIG_STARTER_SECTION = "starter"
Field Value
Type |
Description |
System.String |
|
CONFIG_STARTERS_SECTION
Declaration
public const string CONFIG_STARTERS_SECTION = "starters"
Field Value
Type |
Description |
System.String |
|
CONFIG_SWITCH
Declaration
public const string CONFIG_SWITCH = "config"
Field Value
Type |
Description |
System.String |
|
CONFIG_TIMESOURCE_SECTION
Declaration
public const string CONFIG_TIMESOURCE_SECTION = "time-source"
Field Value
Type |
Description |
System.String |
|
CONFIG_UNIT_TEST_ATTR
Declaration
public const string CONFIG_UNIT_TEST_ATTR = "unit-test"
Field Value
Type |
Description |
System.String |
|
m_CommandArgs
Declaration
protected ConfigSectionNode m_CommandArgs
Field Value
m_ConfigRoot
Declaration
protected ConfigSectionNode m_ConfigRoot
Field Value
m_ConfigSettings
Declaration
protected List<IConfigSettings> m_ConfigSettings
Field Value
m_DataStore
Declaration
protected IDataStoreImplementation m_DataStore
Field Value
m_EventTimer
Declaration
protected IEventTimerImplementation m_EventTimer
Field Value
m_FinishNotifiables
Declaration
protected List<IApplicationFinishNotifiable> m_FinishNotifiables
Field Value
m_Glue
Declaration
protected IGlueImplementation m_Glue
Field Value
m_Instrumentation
Declaration
protected IInstrumentationImplementation m_Instrumentation
Field Value
m_Log
Declaration
protected ILogImplementation m_Log
Field Value
m_Module
Declaration
protected IModuleImplementation m_Module
Field Value
m_ObjectStore
Declaration
protected IObjectStoreImplementation m_ObjectStore
Field Value
m_SecurityManager
Declaration
protected ISecurityManagerImplementation m_SecurityManager
Field Value
m_TimeSource
Declaration
protected ITimeSourceImplementation m_TimeSource
Field Value
Properties
Active
Returns true when application instance is active and working. This property returns false as soon as application finalization starts on shutdown
Use to exit long-running loops and such
Declaration
public bool Active { get; }
Property Value
Type |
Description |
System.Boolean |
|
AllowNesting
Returns true if the app container allows nesting of another app container
Declaration
public virtual bool AllowNesting { get; }
Property Value
Type |
Description |
System.Boolean |
|
CommandArgs
Provides access to command line args
Declaration
public IConfigSectionNode CommandArgs { get; }
Property Value
ConfigRoot
Provides access to configuration root for the whole application
Declaration
public IConfigSectionNode ConfigRoot { get; }
Property Value
DataStore
References application data store
Declaration
public IDataStore DataStore { get; }
Property Value
EventTimer
References event timer which maintains and runs scheduled Event instances
Declaration
public IEventTimer EventTimer { get; }
Property Value
ForceInvariantCulture
True to force app container set process-wide invariant culture on boot
Declaration
public virtual bool ForceInvariantCulture { get; }
Property Value
Type |
Description |
System.Boolean |
|
Glue
References glue that can be used to interconnect remote instances
Declaration
public IGlue Glue { get; }
Property Value
InstanceID
Returns unique identifier of this running instance
Declaration
public Guid InstanceID { get; }
Property Value
Type |
Description |
System.Guid |
|
Instrumentation
References application instrumentation
Declaration
public IInstrumentation Instrumentation { get; }
Property Value
IsUnitTest
True if this container is a test rig
Declaration
public virtual bool IsUnitTest { get; }
Property Value
Type |
Description |
System.Boolean |
|
LocalizedTime
Returns current time localized per TimeLocation
Declaration
public DateTime LocalizedTime { get; }
Property Value
Type |
Description |
System.DateTime |
|
Log
References application logger
Declaration
Property Value
ModuleRoot
References the root module (such as business domain logic root) for this application. This is a dependency injection root
provided for any application type
Declaration
public IModule ModuleRoot { get; }
Property Value
Name
Returns the name of this application
Declaration
public string Name { get; }
Property Value
Type |
Description |
System.String |
|
ObjectStore
References application object store. Objects will survive application termination
Declaration
public IObjectStore ObjectStore { get; }
Property Value
SecurityManager
References security manager that performs user authentication based on passed credentials and other security-related global tasks
Declaration
public ISecurityManager SecurityManager { get; }
Property Value
ShutdownStarted
Returns true to indicate that Dispose() has been called and shutdown has started
Declaration
public bool ShutdownStarted { get; }
Property Value
Type |
Description |
System.Boolean |
|
StartTime
Returns timestamp when application started as localized app time
Declaration
public DateTime StartTime { get; }
Property Value
Type |
Description |
System.DateTime |
|
Stopping
Returns true to indicate that Stop() was called
Declaration
public bool Stopping { get; }
Property Value
Type |
Description |
System.Boolean |
|
TimeLocation
Returns time location of this LocalizedTimeProvider implementation
Declaration
public TimeLocation TimeLocation { get; set; }
Property Value
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
public ITimeSource TimeSource { get; }
Property Value
Methods
BeforeDataStoreStart(IDataStoreImplementation)
Override to prep data store implementation i.e. inject something programmaticaly
Declaration
protected virtual void BeforeDataStoreStart(IDataStoreImplementation datastoreImplementation)
Parameters
BeforeEventTimerStart(IEventTimerImplementation)
Override to prep event timer implementation i.e. inject something programmaticaly
Declaration
protected virtual void BeforeEventTimerStart(IEventTimerImplementation eventTimerImplementation)
Parameters
BeforeGlueStart(IGlueImplementation)
Override to prep glue implementation i.e. inject something programmaticaly
Declaration
protected virtual void BeforeGlueStart(IGlueImplementation glueImplementation)
Parameters
BeforeInstrumentationStart(IInstrumentationImplementation)
Override to prep instr implementation i.e. inject something programmaticaly
Declaration
protected virtual void BeforeInstrumentationStart(IInstrumentationImplementation instrumentationImplementation)
Parameters
BeforeLogStart(ILogImplementation)
Override to prep log implementation i.e. inject log destinations programmaticaly
Declaration
protected virtual void BeforeLogStart(ILogImplementation logImplementation)
Parameters
BeforeModuleStart(IModuleImplementation)
Override to prep module implementation i.e. inject modules programmaticaly
Declaration
protected virtual void BeforeModuleStart(IModuleImplementation logImplementation)
Parameters
BeforeObjectStoreStart(IObjectStoreImplementation)
Override to prep object store implementation i.e. inject something programmaticaly
Declaration
protected virtual void BeforeObjectStoreStart(IObjectStoreImplementation objectstoreImplementation)
Parameters
BeforeSecurityManagerStart(ISecurityManagerImplementation)
Override to prep security manager implementation i.e. inject something programmaticaly
Declaration
protected virtual void BeforeSecurityManagerStart(ISecurityManagerImplementation securitymanagerImplementation)
Parameters
BeforeTimeSourceStart(ITimeSourceImplementation)
Override to prep time source implementation i.e. inject something programmaticaly
Declaration
protected virtual void BeforeTimeSourceStart(ITimeSourceImplementation timesourceImplementation)
Parameters
CleanupApplication()
Declaration
protected virtual void CleanupApplication()
Destructor()
Declaration
protected override void Destructor()
Overrides
DoCleanupApplication()
Declaration
protected virtual void DoCleanupApplication()
DoInitApplication()
Declaration
protected virtual void DoInitApplication()
DoModuleAfterInitApplication()
Declaration
protected virtual void DoModuleAfterInitApplication()
DoModuleBeforeCleanupApplication()
Declaration
protected virtual void DoModuleBeforeCleanupApplication()
GetConfiguration()
Declaration
protected virtual Configuration GetConfiguration()
Returns
GetDefaultConfigFileName()
Tries to find a configuration file name looping through various supported estensions
Declaration
protected string GetDefaultConfigFileName()
Returns
Type |
Description |
System.String |
File name that exists or empty string
|
GetStarters()
Declaration
protected IEnumerable<IApplicationStarter> GetStarters()
Returns
InitApplication()
Declaration
protected virtual void InitApplication()
LocalizedTimeToUniversalTime(DateTime)
Converts localized time to UTC time as of TimeLocation property
Declaration
public DateTime LocalizedTimeToUniversalTime(DateTime local)
Parameters
Type |
Name |
Description |
System.DateTime |
local |
|
Returns
Type |
Description |
System.DateTime |
|
MakeNewSessionInstance(Guid, User)
Makes BaseSession instance
Declaration
public virtual ISession MakeNewSessionInstance(Guid sessionID, User user = null)
Parameters
Type |
Name |
Description |
System.Guid |
sessionID |
|
User |
user |
|
Returns
NotifyAllConfigSettingsAboutChange()
Forces notification of all registered IConfigSettings-implementers about configuration change
Declaration
public void NotifyAllConfigSettingsAboutChange()
NotifyAllConfigSettingsAboutChange(IConfigSectionNode)
Forces notification of all registered IConfigSettings-implementers about configuration change
Declaration
protected void NotifyAllConfigSettingsAboutChange(IConfigSectionNode node)
Parameters
PreloadAssemblies(Boolean)
RESERVED for future use. Loads assemblies specified in 'preload-assemblies' section from disk optionally checking the 'enabled' flag.
This method is called on application startup by the framework
Declaration
public bool PreloadAssemblies(bool checkFlag = true)
Parameters
Type |
Name |
Description |
System.Boolean |
checkFlag |
|
Returns
Type |
Description |
System.Boolean |
|
RegisterAppFinishNotifiable(IApplicationFinishNotifiable)
Registers an instance of IApplicationFinishNotifiable with application container to receive a call when
underlying application instance will finish its lifecycle
Declaration
public bool RegisterAppFinishNotifiable(IApplicationFinishNotifiable notifiable)
Parameters
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
public bool RegisterConfigSettings(IConfigSettings settings)
Parameters
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
UniversalTimeToLocalizedTime(DateTime)
Converts universal time to local time as of TimeLocation property
Declaration
public DateTime UniversalTimeToLocalizedTime(DateTime utc)
Parameters
Type |
Name |
Description |
System.DateTime |
utc |
|
Returns
Type |
Description |
System.DateTime |
|
UnregisterAppFinishNotifiable(IApplicationFinishNotifiable)
Removes the registration of IConfigSettings from application container
Declaration
public bool UnregisterAppFinishNotifiable(IApplicationFinishNotifiable notifiable)
Parameters
Returns
Type |
Description |
System.Boolean |
True if notifiable instance was found and removed
|
UnregisterConfigSettings(IConfigSettings)
Removes the registration of IConfigSettings from application container
Declaration
public bool UnregisterConfigSettings(IConfigSettings settings)
Parameters
Returns
Type |
Description |
System.Boolean |
True if settings instance was found and removed
|
WriteLog(MessageType, String, String, Exception, String, Int32, Object)
Declaration
protected void WriteLog(MessageType type, string from, string msgText, Exception error = null, string file = "", int line = 0, object pars = null)
Parameters
Type |
Name |
Description |
MessageType |
type |
|
System.String |
from |
|
System.String |
msgText |
|
System.Exception |
error |
|
System.String |
file |
|
System.Int32 |
line |
|
System.Object |
pars |
|
Implements
System.IDisposable
Extension Methods