Need advice on IoC and DAOs
I'm trying to take an old DAO pattern and rewrite it for use with an IoC container.
Here's my current architecture:
* a util object that can hand back datasource objects
* an "extractor" object that does the work of extracting data from my database
* a set "model" objects that my extractor fills up with the extracted data
so right now what I do is:
* fire up teh extractor
* the extractor goes and gets a datasource from the util object
* the extractor instantiates and fills the model objects and hands those back to the caller.
In other words, my "action" code that needs the data does this to get it:
Model = dbExtractor.extractModel();
Where an how can IoC help with this architecture. Should I be letting the container create the Datasource object (instead of having a util class do it) and a set of empty model objects and then injecting those into the extractor? What benefit would that provide?
What would be ideal is if my action class didn't have to know about the extractor but could just have an instantiated and populated model injected into it. I'm a bit unclear about how that would be wired up, though.