May 27, 2011 at 3:40 PM
Edited May 27, 2011 at 3:40 PM
There are two common approaches;
1. Service pattern
This involves creating an IMyService (which inherits from IDependency) and a default implementation. Consumers can import this dependency to access methods on your service. Typically there is one service implemented per module or feature.
2. Event / provider pattern
This involves creating an interface which with inherits from IDependency or IEventHandler; then in your service or elsewhere you can import an IEnumerable<ISomeProvider>. With an event handler you just import IMyEventHandler and a single call to it
will actually call all the implementors. Using either of these methods you can consume implementations from modules so other people can then extend your module.
I use this a lot in Science Project and Media Garden; both those projects are implemented as a number of separate modules that interact with each other in this way.