Why Use StructureMap? • Achieve loose coupling • Extensibility everywhereDesign • Improve testability • SOLID! • Mature: one of the oldest containers • One of the fastest IoC containersFeatures • Easy to learn Domain Specific Language • Fully-loaded
Service Locator Design pattern which encapsulates theprocesses involved in obtaining a service. Requester Service Locator Based on configuration, builds Asks the locator for a up and returns the requested particular service. service.
Model-View-Presenter MVP is a user interface design pattern engineered to improve the separation of concerns within an application’s presentation layer. Model View Presenter Object that Interface that Acts upon thedefines the data displays the data. model, tells theto be displayed. view what to do.
ASP.NET MVC DependencyResolver http://mysite/Home/Index Hey, give me the HomeController! ASP.NET MVC Pipeline DependencyResolver Here ya go! Activator.CreateInstance( typeof(HomeController));
ASP.NET MVC DependencyResolver Hey, give me the HomeController! ASP.NET MVC Pipeline SmDependencyResolver Here ya go! Container.GetInstance( typeof(HomeController));
Decorator Pattern Design pattern that allows behavior to be added to an object at runtime. Service Interface Decorated Type Decorator Defines the public Wraps an instancecontract for the type Base type that of the service being extended. implements in interface to add the interface. new behavior.