I am creating an Extensible application using MEF to allow my customer to develop their own modules and extensions, i have some special exports like integrated modules, and i want to prevent other developers from importing or rewriting that modules, please guide me how to do that.
for example: i have the IShellService
public interface IShellService
{
// providing the shell functions and properties
}
and an interface for the DashboardModule
public Interface IDashboardModule {}
Consuming IShellService
in a Module looks as follows:
Export(typeof(IModule))
public MyModule
{
[ImportConstructor]
public MyModule(IShellService shellservice)
{
// ...
}
}
how to ensure that the MyModule
will use in the constructor the Shell Service that i provided in the Shell, not an other one that some Modules created, because may some one will export a module with this type IShellService
in this case the MEF
will confuse between two Exported values of and i want it be one export and one import, no one can export this type.
The same problem with the Dashboard Module, i want only my Dashboard Module Implementation (Exportation).