Hi, I want to implement architecture involving different .NET assemblies (i.e. modules). Some of these modules should provide services which are used as .NET interfaces by other modules. The modules should be loaded and registered dynamically at runtime, I do not want to have "hardcoded" dependencies between them.
Example:
Module1.dll: Defines a class implementing interface IService1 Module2.dll: Uses the class provided by Module1 through the interface IService1
The problem is where to put the definition of IService1
: Both modules need this definition. But since Module2
should also work in absence of Module1
(the availability of the service is checked at runtime) I don't want Module2.dll
to reference Module1.dll
directly.
One possibility is to split every module into two assemblies (interface and definition), but that would mean that I double the number of DLLs which I do not want.
I thought also of using a separate "Interface Dll" i.e. one single assembly containing all interface definitions, but then again, if I change one single interface or if I add new modules (with new iterfaces), I need to update this central DLL and therefore all other modules (since they all depend on it...)
What I would like is to link the interface definition into both Module1
and Module2
, but I do not know if resp. how this is possible.
I'd appreciate any ideas
Edit
Perhaps the example was a bit too simple: There could be a scenario where Module1a.dll
, Module1b.dll
etc. provide implementations for IService
and Module2a.dll
, Module2b.dll
etc. are using them...