Interface? Abstract? DLL? Component? please help
-
I am creating an app, that needs numerous "drivers" the "drivers" are simple components that will accept a string, parse it and change some data in the main app. I want to be able to load all of the drivers from a directory at run-time. So I can just place a new one in the directory and run the app without re-compiling. Could someone please point me in the right direction. I am assuming each would go into their own DLL and be based on either an interface or a base class. But I still can't see the big picture and how they would load at run-time, or how they would fit into the main app. Thank you very much for any help.
-
I am creating an app, that needs numerous "drivers" the "drivers" are simple components that will accept a string, parse it and change some data in the main app. I want to be able to load all of the drivers from a directory at run-time. So I can just place a new one in the directory and run the app without re-compiling. Could someone please point me in the right direction. I am assuming each would go into their own DLL and be based on either an interface or a base class. But I still can't see the big picture and how they would load at run-time, or how they would fit into the main app. Thank you very much for any help.
Interfaces or abstract classes are a start, but you really need a way to resolve the
Type
as well. This usually entails having a custom configuration section in your .config file that registers theType
associated with a particular operation, sort of how aType
to create for the<httpHandlers>
section is associated with HTTP verbs and a path from which files that need to be handled are associated with theIHttpHandler
orIHttpHandlerFactory
. To make it easier, you should include yourl libraries either in your application's private path (the app's directory or any directory specified in your .config file under theconfiguration/runtime/assemblyBinding/probing
section inside theprivatePath
attribute. For a good example, see the ASP.NET Web Matrix (a Microsoft employee-driven, free ASP.NET designer) at http://www.asp.net/[^]. There are also several good articles available here on CP about that cover this (though many use a proprietary configuration file, while I find using the .config file that is common to all runtime applications better). You just need to do a search. :)-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----