override default implementation of some interface

Jan 28, 2009 at 10:14 PM
What is the correct implementation when i have a default implementation of some interface in the default assembly. During the application startup i will check plugin assemblies of they contain an implementation of some interface, if yes register that implementation, else register the default implementation.. Tips are welcome!


Feb 2, 2009 at 8:38 AM
Not sure if this is what you want, might be worth the try.  Here's a unity extension written by David Hayden.

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
Feb 2, 2009 at 7:22 PM
The thing to remember about Unity interception is "last one wins". As such, the easiest way to implement what you describe is to just go ahead and register your default implementation first. Then do your assembly scanning, and if you find another implementation just register it in the container. This will overwrite the previous default registration. The net result is the default will be there if no plugins implement the interface, but if it does you'll use the plugin instead. Which I think was what you asked for.

Feb 2, 2009 at 7:35 PM
Correct! Thanks.. Maybe this should be added to the documentation..