===============
Startup Actions
===============
- The XML Configuration file has **iocConfiguration/startupActions/startupAction** elements for specifying any number of startup actions. Each **startupAction** element specifies a type that is an implementation of interface **IoC.Configuration.OnApplicationStart.IStartupAction**.
- When the XML configuration file is loaded **IoC.Configuration** will call the method **IoC.Configuration.OnApplicationStart.IStartupAction.Start()** for each startup action specified in **startupAction** elements.
- When the XML configuration file is disposed of (when **IoC.Configuration.DiContainerBuilder.IContainerInfo** is disposed of), **IoC.Configuration.OnApplicationStart.IStartupAction.Stop()** is called on each startup action.
- Startup actions are integrated into dependency injection mechanism. Therefore, the constructor parameters of **IoC.Configuration.OnApplicationStart.IStartupAction** implementations specified in **startupAction** elements will be injected using the bindings specified in XML Configuration file or in modules referenced by the configuration file. Also, **parameters** and **injectedProperties** elements can used with **startupActions** to specify constructor parameter values or to inject properties.
- **IoC.Configuration** waits for up to 15 seconds, to make sure that all startup actions are given enough time to properly stop (e.g., stop the threads if necessary).
.. note::
If all startup actions have **true** value of property **IStartupAction.ActionExecutionCompleted**, before 15 seconds passes, the wait time will be shorter.
Here is an example of startup action elements in configuration file:
.. code-block:: xml
Here is the definition of interface **IoC.Configuration.OnApplicationStart.IStartupAction**
.. code-block:: csharp
public interface IStartupAction
{
///
/// If true, the action was successfully stopped.
///
bool ActionExecutionCompleted { get; }
///
/// Starts the action.
///
void Start();
///
/// Stops the action.
///
void Stop();
}