Is there a way to force a static method to be executed in system initialization?
I'm developing a system all based in plugins. The core of the project will contain the system's state and will fire some events where plugins can hook up and create new features.
I want this plugin mechanism to be done transparently from plugins. All the plugin must do is implement an event of the system core and it should be executed correctly. The problem is for do that I need to execute some code on each plugin to hook the system core events. The solution I first thought was to declare some method in these plugins that will be executed when the assembly is loaded or something like that, but apparently static constructors are only executed when some reference of any of his fields is made; but in my design it can't be done: the plugins must stay invisible for the system core.
The plugins are essentially other classes or other projects.
Any thoughts?
Thanks.