Plugins inside multitenant environment
We are building an asp.net mvc app with servicestack api. We have a plugin system which allows us dynamically load/unload plugins (Plugin is a custom servicestack plugin) as long as it is not multitenant solution there is no problems, if we wanted another version of plugin we install it during runtime and restart appdomain works like a charm. Now the question is is there a way to do this on multitenant situations where plugins must be loaded/unloaded on each request. To unload them maybe it is not that big of a problem, but how to deal when we have multiple versions of same plugin and one request one needs to be served, another request different. Maybe you could give us some hints....
Plugins need to be loaded once on AppStartup in AppHost.Configure(). Plugins are able to modify any static AppHost configuration, doing so at runtime is not ThreadSafe where any change will affect all concurrent requests and mutating collections will throw concurrency exceptions.
The List of Plugins can be dynamically constructed on StartUp by modifying the Plugins collection, but not at runtime.