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
  • Using AfterInitialization does solve the timing issue, so we can use that pattern elsewhere. What was catching me out was that the reference in PluginConnectionStrings had a bad namespace, not sure when that happened but it meant that SetController was never called. The issue here is that the SQL plugin and the Core plugin remained enabled, even though an exception had been thrown that meant they should not be working or enabled.  If an exception is thrown within the main plugin or it's dependent plugins then I think they should all be automatically disabled as they are in an inconsistent state.    

Children
  • Using AfterInitialization does solve the timing issue

    Glad to hear it. And really, you probably don't even need that since controllers are injected on all plugins before any plugins Initialize().

    If an exception is thrown within the main plugin or it's dependent plugins then I think they should all be automatically disabled

    This also is the case in some cases - at least for individual plugins, not a parent-child relationship. While I understand this argument, there are lots of reasons and places a plugin can throw an exception where this could be counterproductive.