dependency injection - Help me with architecture to encapsulate my databases (maybe DI/IoC?) -
I am creating a Windows-Form application that performs some analysis which depends on 3 different databases Two are actually Geographic Databases (ESRI) and one of the information is a standard CRUD-type repository. Let's call them GeoRefDatabase, GeoResultDatabase, and RulesDatabase respectively. There will be different types of analysis classes (eventually as 10) which require access to all 3 databases.
- GeoRefDatabase is centralized and will never require connection string.
- GeoResultDatabase where some output of the analysis will be stored. This is a "connection string" and physical location may vary on run time (each time an analysis is said). The result is that many of these examples will be there.
- Rule database is centralized and never runs. For this, the connection string will be required.
So for example, I want to do something like this:
var dbRef = GetDbRef (); Var dbRules = GetDbRules (); Var dbResult = GetDbResult (myLocation); Var z = Analysis A (DBR, DBR, DB, Array);
For questions now .....
- How do I explain these databases? I am getting acquainted with IOC / DI and leaning towards it, but I'm not sure what the best way should be.
- What is the best way to process connection strings? App.confg?
For two databases which are not running it candidate for DI, because it Often will not work, but may be at some point.
How do you determine the runtime, which other database to go to?
If you know the connection string before time, put them in an array of stars, and inject into it, then you can choose which one of three or four connection wires is used in the array Please. You want two arrays, there is a connection string, the names of the other databases, so you can put it in a hashup.
By putting them in App.config, there will be a potential candidate, at least in my experience.
Comments
Post a Comment