0

I am currently working on a project that has an application layer and class library which is working great.
But I got a new requirement for another client for the same application everything remains same except the logic in class library.
So, I am wondering if we can have some solution to have two different class libraries for each application and based on the appsetting in web.config, we can select which library to load.
Any help and ideas are greatly appreciated.

Thanks.

Krishna
  • 1,936
  • 5
  • 22
  • 30
  • 2
    Sounds like you want to investigate Inversion of Control/Dependency Injection frameworks like StructureMap, Ninject, etc. They allow you to provide different implementations of a common interface which can be configured using config files. – Mike Parkhill Dec 04 '12 at 18:30
  • Realised my answer might make things worse if you don't know what IOC is - http://en.wikipedia.org/wiki/Inversion_of_control or the difference between that and MEF http://stackoverflow.com/questions/1288376/mef-vs-any-ioc – Sean Dec 04 '12 at 18:34

1 Answers1

0

Have you tried looking at MEF from microsoft? http://en.wikipedia.org/wiki/Managed_Extensibility_Framework it allows you to add plugins at runtime, which means you could pick which dll you wanted to load.

Sean
  • 696
  • 2
  • 9
  • 24
  • In both the cases, I think I should change the implementation in the application layer. Right? – Krishna Dec 04 '12 at 19:16
  • Yes, with both MEF and IoC/DI you'd need to make your dependence between the "application layer" and the "class library" abstract enough to be able to swap in another implementation. Have you heard of the dependency inversion principle? http://en.wikipedia.org/wiki/Dependency_inversion_principle – Sean Dec 05 '12 at 09:46