candland.code
Monday, March 03, 2008
« Prefer Equals over operator== because ge...
|
Main
|
Circuit City Sucks [rant] »
IoC smell: Having IContainerAccessor as a dependency.
Looking back, it should have been an obvious thing to not do, but it wasn't. I wanted to get access to the container and so I made IContainerAccessor a dependency for my class. The I added that to the container. The Main problem was that the IContainerAccessor interface was implemented on the class that also created the container. So, after startup I had two containers, one I created for the application and one that container created when the IContainerAccessor was created.
Okay, there are other ways to implement the IContainerAccessor, but is that what I really needed? No, I really needed a way to create a specific kind of component. Maybe like a factory of some sort. Oh, yea the factory pattern is already sitting around waiting to be used. And it was a good solution here.
That makes me think, for most cases where you want the container directly, there is a better solution waiting to be used.
castle
Comments [0]
Related posts:
Warming up to MVC2, Castle, and Spark with Red Yawk
Resolve Lists and Arrays with Castle Windsor
Intercepting NHibernate to Handle Additional Database Work
NHibernate Session Per Request Using Castles WcfFacility
Unit Testing WCF Security with Castles WcfFacility
Setting Up AutoMapper For Use From A Container
Comments are closed.
Top Postings
Sum a column in a tab-delimited file usi...
Resolve Lists and Arrays with Castle Win...
Overriding NServiceBus Configuration
A New Year & A New Venture: Red27 Co...
How to test a mocked object when that ob...
Search
Tags
activerecord (2)
aimcc (3)
applications (2)
asp.net (8)
automapper (1)
AwsS3Library (3)
boo (3)
book (2)
brail (1)
build (6)
castle (27)
consulting (1)
csharp (40)
css (1)
dasBlog (3)
database (1)
facebook (1)
flash (1)
fluentnhibernate (2)
gnucash (1)
intermediate language (1)
javascript (8)
jquery (1)
Linq (2)
log4net (1)
monorail (12)
msbuild (2)
mvc (6)
n2cms (5)
nant (3)
nhibernate (12)
NS3Library (2)
nservicebus (4)
openid (1)
opensource (2)
powershell (10)
process (1)
prototype (5)
psake (6)
rant (1)
red27 (1)
redyawk (1)
review (2)
rhinomocks (3)
s#arp architecture (1)
sftp (1)
silverlight (1)
spark (3)
subversion (1)
teamcity (1)
testing (11)
tools (7)
vim (2)
visualstudio (5)
wcf (1)
webservices (4)
windows (4)
wix (3)
Links
Code Format
Amazon.com Widgets
About Me
I'm Dusty Candland a software developer in Colorado.
Email
Projects
Red27 Consulting
BambooTide
CloudSH.com
NS3Library