Using StructureMap Registries for better separation

When it comes to configuring StructureMap, it supports the use of Registries. Registries support everything that the standard configure method does(new Container(c => { /* */});). There are two main reasons that I use the registries rather then doing all my configuration in the Container’s lambda: separation of concerns (one registry per area of code) and easier testing (which we will go into shortly). The only down side I can see to using registries is that it can scatter your configuration across your codebase - but if you have ReSharper, doing a ‘Find Implementations’ on Registry will find them all for you, so it really isn’t much of a down side....

May 19, 2014 · 3 min