Injecting Container into a Service Locator

May 15, 2008 at 3:56 PM

Im tinkering with the idea of a DaoServiceLocator which would act as an access point for my data access points.  Instead of injecting all of my dao implementations (IProductDao, ICustomerDao, IOrderDao etc) I would like to pass in the container so that these can be resolved on an as-needed basis.  My thinking is that my presenters (in an MVP web app) need access to the data access objects all over the place and I'd rather avoid constructors with an excessive amount of arguments (although I guess property injection would solve this...).

Anyway  I have a couple of questions about this

a) Is this a bad idea?  Does it go against the idea of an IoC container (and if so, why).

b) How would this be achieved through the xml config file?

Thanks for any feedback,