We are building an app for few customers, each has its own requirements along with the similar ones. We also want to keep all the code in the same app, not branch it, and the IF
I would use Unity, but as a Simple Factory.
Unity Framework: How to Instantiate two classes from the same Interface?
You could store your
I am using Unity.2.1.505.2 (just in case that makes a difference).
Here is the DotNet code.
UnityContainer container = new UnityContainer();
UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
section.Configure(container);
string myKey = "John"; /* read from config file */ /* with this example, the value should be "myCarKey" or "myTruckKey" */
IVehicle v1 = container.Resolve(myKey);
See:
http://msdn.microsoft.com/en-us/library/ff664762(v=pandp.50).aspx
and
http://www.sharpfellows.com/post/Unity-IoC-Container-.aspx