The IBeforeInitializationPlugin is a plugin that allows you to execute code after plugins are instantiated but before plugins initialize.
[toc]
What would I use IBeforeInitializationPlugin for?
This plugin is useful anytime you have something that needs to be available to all your custom plugins before they initialize. This could be something as simple as a global variable. More commonly it is useful if you are using a Dependency Injection framework(referred to later as a DI Framework) and you must bind your services.
Plugin Lifecycle
If you are not already you should familiarize yourself with the Plugin Lifecycle. IBeforeInitializationPlugins will execute after enabled plugins are instantiated and configured and before Apis are registered. This means any global variables (assuming static variables assigned a value or variables in the proper scope) or bound services from for your DI framework will be available in an IApiDefinition plugin if you are using one or if not in the Plugin.Initialization() method and later. These would not be available for use when IRecurringEvolutionJobs register their default schedules or context, IConfigurablePlugins define configuration, or ITranslatablePlugins register their translations.
[Re-Use Image]
Anatomy
An IBeforeInitializationPlugin in addition to the normal IPlugin members only have a single method, OnBeforeInitialization receiving a BeforeInitializationArguments object. This plugin is slightly different than most others in the sense that is written like its an Event handler, though it is not a true event. Instead the BeforeInitialization(...) method that is invoked before plugin initialization.