Order of events when plugins are initializing

I am seeing that 

Events_BeforeUpdate(UserBeforeUpdateEventArgs e)
is being called before 
SetController(ISqlServerConnectedPlugionController controller)
The event is being setup in the main plugin and the ISqlServerConnectedPlugin is a child of this plugin.

Parents
No Data
Reply Children
  • that's great for simple plugins, but ones that are complex and need separation of concern

    I can assure you I've used this pattern on highly complicated plugins (including many components of the platform, itself) with clear separations of concerns, DI, etc. It's in service of that, not orthogonal to it. That said, it's just one of many possible approaches.

    or always initialize the ISqlServerConnectedPlugins first?

    This actually is the case. Let's back up for a moment:

    For any given set of plugins, their controllers are injected before they're initialized. This includes ISqlServerConnectedPlugin, IConfigurablePlugin, etc. 

    The order is:

    1. ISqlServerConnectedPlugin.SetController (called on all plugins of this type, in a non-deterministic order)
    2. IPlugin.Initialize (called on all plugins, but the order is non-deterministic)
    3. PluginManager.AfterInitialize (after all plugins have initialized)