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
Does each customer get their own exe and config file, and there is a shared dll? Or is there a shared exe, and each customer has their own dll?
You can put the full type name in the configuration like this:
Shared.exe.config:
And put AssemblyForJohn.dll in the same folder as your Shared.exe.
Then you can load it dynamically in code like this:
Shared.exe:
var typeString = ConfigurationManager.AppSettings["CustomerType"];
var parts = typeString.Split(',');
var typeName = parts[0];
var assemblyName = parts[1];
var instance = (BaseClass)Activator.CreateInstance(assemblyName, typeName).Unwrap();