I am creating some kind of a plug-in system. Currently I was using WinForms
application to load the assemblies, using Assembly.Load
and Activator.CreateInstance
. The WinForms GUI was supposed to show only the names of the currently loaded assemblies (plugins).
There is a class in the library PluginManager
, that instantiates and holds a list of all IPlugin
implementors.
However, I now want to be able to access the list of plugins (their names only) from the Silverlight
application.
I have a Silverli开发者_Python百科ght 4
application created in Visual Studio.
This added two projects:
MyProject
(SL 4 project)MyProject.Web
(containing the .aspx startup page which runs the .xap file)
What I need is for the PluginManager
and its instantiated plugins to be loaded not only during the silverlight page request (thru aspx page), but all the time, even if the user never opens the silverlight app in the browser. And I am confused as to what is the entry point of the .Web project. (in console app, I would put the code into the Main method, in WinForms in Loaded event handler, but I don't know where to start my "service" in this .Web
project).
How does this work? Where should I instantiate my PluginManager
? Is that .Web
project short-lived only during the HTTP request or can it be run continuously?
Add Global.asax to MyProject.Web. And do that in Application_Start() method. This method invokes only once when application is built.
If you need to run your PluginManager before application has been built, you should create a windows service which runs from your installer. This service will instantiate PluginManager.
精彩评论