Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Your profile
Tag cloud
.net asp.net asp.net mvc azure book bug business intelligence c# cloud computing database dates excel gemini google gotcha how to howto iis indexing interview kanban linq madison measurement mvc nhibernate nunit performance process improvement programming rhino mocks security silverlight sql sql friday sql server sql server 2000 sql server 2005 sql server 2008 sql server 2008 r2 sqlserver structuremap t-sql tip trick unit testing vb.net vista visual studio 2010 windows 7
Authors
- SQLDenis (268)

- chrissie1 (199)

- onpnt (96)

- George Mastros (35)

- Alex Ullrich (24)

- tarwn (16)

- naomi (9)

- ca8msm (7)

- damber (7)

- thatrickguy (7)

- emtucifor (7)

- chopstik (6)

- More...
Main Categories
Search
Google Ads
Tags: structuremap
For my usercontrols I tend to use the StructureMap BuildUp feature. I will leave it to the big man himself to introduce you to this feature.
I use property injection in this case because the designer doesn't like usercontrols that have constructors that are not empty, since it will try to execute the code in that constructor. So we revert to property injection and the BuildUp feature....
So we have a windows forms application and some of these forms can only be used once. Like for instance a dashboard. Everytime we show the form we just want it to either show a new one, if it's the first time opened, or we want to show the one that already exists. In essence, this would be good case for a singleton pattern. But the singleton pattern is evil. Why is it evil? Because it is hard to unittest. And it makes us do something that we really don't want to.
So having established that we got to find a better solution for this poblem. And we have. It's called StructureMap. Stru...
So you have lots of forms in your winforms application and you have to open them from several places/forms. But you don't want to repeat yourself all the time. And you like to keep things centralized. You also want it to be flexible, if possible and easily extendable/extensible/extendingable, uhm, be able to extend it in an easy manner. I think this is a typical case for the command pattern. So let's start with that.
Warning! what follows is a lot of code. So this will be a long post. But you can skip all the parts you don't like. Not that you will.
Let's start by creating a...
I was not really convinced in the past that I should use the Structuremap Automocker for any of my tests. I don't like using the container in my tests it makes them way to dependent on something not really needed to run the test. Of course I test to see if the container is well configured and if the objects are created by the container when it is well configured (this has saved me several times before). I really only have myself to blame because I didn't really try it and only suspected what it was doing.
Well apparently I was wrong, and lucky for me I read the right blogs.
In my previous post I already mentioned the BuildUp method in StructureMap and how cool that can be. And now I want to show you how to do this in VB.Net. As we all know VB.Net doesn't like Multiline lambdas or void lambdas. But we will kill somebody for that later. In this example I also used a real form and it didn't get hurt by the designer this time.
The code is pretty much the same as my previous post.
Here are the services and their interfaces.
:: Next >>


LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.