tag:blogger.com,1999:blog-15136575.post3303258441515029372..comments2023-10-17T12:00:16.772+01:00Comments on Code rant: Further Reading on IoC ContainersMike Hadlowhttp://www.blogger.com/profile/16441901713967254504noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-15136575.post-73614631863344859442009-02-12T12:33:00.000+00:002009-02-12T12:33:00.000+00:00Hi Ulu,WebForms is a poor choice for component ori...Hi Ulu,<BR/><BR/>WebForms is a poor choice for component oriented application development. You are faced with building your own abstraction (MVC/MVP) on top of it if you are serious about components. I would recommend that you seriously consider using MVC Framework or Monorail instead.Mike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-6356033862535119342009-02-12T12:12:00.000+00:002009-02-12T12:12:00.000+00:00I see. You are referring to an MVC Asp.Net applica...I see. You are referring to an MVC Asp.Net application. With WebForms, it's got to be a ServiceLocator, I guess..uluhttps://www.blogger.com/profile/09205790793910716812noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-23944147871110003002009-02-12T09:59:00.000+00:002009-02-12T09:59:00.000+00:00Hi Ulu,The answer is that you shouldn't have refer...Hi Ulu,<BR/><BR/>The answer is that you shouldn't have references to the container scattered around your application. You should create and configure the container at application start, resolve the root object of your application's object graph and then rely on the container to create instances of dependent objects.<BR/><BR/>Have a look at the Suteki Shop code especially Global.asax.cs InitializeWindsor()<BR/>http://code.google.com/p/sutekishop/source/browse/trunk/Suteki.Shop/Suteki.Shop/Global.asax.cs<BR/><BR/>If you *must* get an object directly from the container use the Common Service Locator:<BR/>http://www.codeplex.com/CommonServiceLocatorMike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-56841582024475357032009-02-12T09:35:00.000+00:002009-02-12T09:35:00.000+00:00For example, in a Web application an instance of t...For example, in a Web application an instance of the container should be created somewhere, and passed somehow to other parts of the application.uluhttps://www.blogger.com/profile/09205790793910716812noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-50573635954011937702009-02-12T09:20:00.000+00:002009-02-12T09:20:00.000+00:00Ulu,I'm not sure what you mean. Can you be a littl...Ulu,<BR/><BR/>I'm not sure what you mean. Can you be a little more specific about what you'd like to do? A reference to what? To be used where?<BR/><BR/>ThanksMike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-76750938087858512222009-02-12T09:18:00.000+00:002009-02-12T09:18:00.000+00:00Hi Ian,Great to hear from you. Can you email me (m...Hi Ian,<BR/><BR/>Great to hear from you. Can you email me (mikehadlow at yahoo dot com) and I'll try to help.Mike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-73160325262064734312009-02-11T19:02:00.000+00:002009-02-11T19:02:00.000+00:00How do you usually pass a reference to the contain...How do you usually pass a reference to the container itself? Do you use a static property?uluhttps://www.blogger.com/profile/09205790793910716812noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-52170056958947729292009-02-11T18:09:00.000+00:002009-02-11T18:09:00.000+00:00Hi Mike!A very long time nospeak/hear/see. It's Ia...Hi Mike!<BR/>A very long time nospeak/hear/see. It's Ian Pender here - it's been a few years. Stumbled across your blog a while ago and I have a little look now and again - very nice!<BR/><BR/>Now I've been using IoC for a couple of years now and all is fantastic, but I've hit a problem and found little support on Castle's site. I just wondered if you had the answer .... if that's not too cheeky.<BR/><BR/>We're using Windsor, and have different IoC containers for different environments. Now ideally we'd like to inherit these IoC settings down, but we can't see a way to re-register a service within a container (to be clear we want to update the service against an interface in a container).<BR/><BR/>Any idea at all ? We've looked at AddComponent overloads. We <B>really</B> want to use code to register rather than config.... <BR/><BR/>Hello again, btw ! Hope you and the family are well!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-15136575.post-83828078559442294172009-02-03T09:35:00.000+00:002009-02-03T09:35:00.000+00:00Hi AnonymousBy 'static' I guess you mean the singl...Hi Anonymous<BR/><BR/>By 'static' I guess you mean the singleton lifestyle, and by 'instance' you mean transient?<BR/><BR/>I haven't noticed any problems with un-released objects in my projects and I primarily build web application and mark my components as transient. On the whole Windsor is pretty good at releasing references. Can you give a specific example of where you've had problems?Mike Hadlowhttps://www.blogger.com/profile/16441901713967254504noreply@blogger.comtag:blogger.com,1999:blog-15136575.post-44244102900800257032009-02-03T00:48:00.000+00:002009-02-03T00:48:00.000+00:00Will you cover some of the pitfalls - such as Wind...Will you cover some of the pitfalls - such as Windsor doesn't do well with cleaning up resources on instance objects - that it's primarily for static objects?Anonymousnoreply@blogger.com