-
4 Advil later and my head really hurts. Here is a little story about how a simple little typo can really cause major headaches and pain. Yesterday I was in the process of setting up one of our new WCF services to use Jimmy Bogard’s solution to use StructureMap to create our services. At one...
-
Today I was trying to debug an issue with some new code that we are working on. During my initial development all my tests worked and everything was fine. However, when I actually hooked up all the pieces and tried to run the new code as a full unit I was receiving the dreaded “ StructureMap...
-
Today I was trying to retrofit the source code from Stephen Bohlen’s great SOLID Dimecasts on Dependency Inversion (episode will be released on 3/26/2009) in order to have it use StructureMap (in order to better show the DIP concept in the episode Stephen did not show the use of an IoC container). ...
-
In a previous post I talked about how you can setup StructureMap to create and use profiles . In this post I would to show you how you can swap out an instance of an object which is part of the profile with a fake/stub for testing. I ran into this scenario the other day while creating a test and...
-
In a previous post I talked about how you can setup Contextual Binding and Profiles with StructureMap 2.5. However since this post was published, the way you can configure Profiles has changed. Because of this I thought I would post a follow-up on how to do this. I also wanted to give...
-
One of the really great things about the latest release of StructureMap is that I do not need to register objects by default if they follow a standard convention (i.e. if I want to register a controller called ‘AuthorController’ and accessed via ‘AuthorController’ I do not need to do anything, SM is...
-
*** There may be a better way to do this with StructureMap, but this is the way I was able to get this to work *** Today I decided I wanted to move all my route mapping for Dimecasts out of the Global.asax file and into each of the various Controllers. I wanted to do this for two reasons. I was starting...
-
Tonight I updated the Dimecasts codebase from the 2.4.9 version of StructureMap to 2.5.0 and ran into few scenarios where some 'hefty' changes were required. I thought I would share the 2 major areas that needed change. Adding named concrete instances for a given interface: Was AddInstanceOf<IAddin>...
-
One of the great new features with StructureMap 2.5 is the ability to have the container auto-wire you dependencies. This means that if you want to you do not need to register all your types. Prior to this release if you wanted to map IFoo to Foo you needed to do something like this: StructureMapConfiguration...
-
If you have not checked out the new AutoMocking Container that is part of StructureMap 2.5 I would highly suggest you do, it rocks. I thought I would show how simple it is to create a PartialMock on the Class under Test (CUT) when using the RhinoAutoMocker. Our Class we want to mock public class VisitReassignmentRule...
-
One of the new features that is part of the next release of StructureMap 2.5 is a AutoMocking Container. What is an AutoMocking Container, well per Jacob over at Eleutian an AutoMocker is AutoMockingContainer is simply a IoCContainer with a custom facility and dependency resolver that supplies a Mock...
-
I have been giving the AutoMocker that is part of StructureMap 2.5 a go lately. Today I was trying to setup my test and I get running into the following error: failed: StructureMap.StructureMapException: StructureMap Exception Code: 230 Cannot call "FillDependencies" on type IGatheringPipeline...
-
One of the really great things about the ASP.Net MVC framework is how extendable it is. One area of extension is in the area of controller creation. The framework allows you to replace the default ControllerFactory with your own factory and because of this we can incorporate Inversion of Control/Dependency...
-
It appears that with the new release of StructureMap 2.4.9 (aka 2.5) the usage of ObjectFactory.ResetDefaults() has been replaced by ObjectFactory.Reset(). Now why is this important? I used .ResetDefaults() in my unit tests when I wanted to reset the plugin graph (is that the correct term?) because I...
-
With the most recent drop of StrcutreMap (2.4.9 -- aka 2.5) you now have the ability to put your wiring information inside the app.config file. Prior to this you needed to either use the StructureMap.config file or wire your dependencies up in code. So today I thought I would simply review how to use...