5. Web App Stock Quotes Authenticator Error Handler Logger Database This example was created by Jim Weirich in Ruby on his blog. See his original article http ://onestepback.org/index.cgi/Tech/Ruby/DependencyInjectionInRuby.rdoc
23. Application ToolWindow A ToolWindow B Contacts Call Support Help File Edit View Tools Help
24. Application Extension A Extension B Need a Toolwindow Got a Toolwindow Need Menus Got a Menu Need a MenuService Got a MenuService
25.
26. Windows And Menus With MEF public interface IToolWindow { } public interface IMenuService { } public interface IMenu { } public class Application { [ Import ] public IEnumerable < IToolWindow > ToolWindows { get ; set ; } [ Import ] public IEnumerable < IMenu > Menus { get ; set ; } } [ Export ( typeof ( IMenuService ))] public class MenuService : IMenuService { }
27. Windows And Menus With MEF [ Export ( typeof ( IToolWindow ))] public class SomeToolWindow : IToolWindow { [ Import ] public IMenuService MenuService { get ; set ; } } [ Export ( typeof ( IMenu ))] public class SomeMenu : IMenu {}