Recursive dependency creation from database id's

I need to recursively recreate dependencies via Dependency Injection using the database id's as shown below.

1
2
3
4
5
6
7
8
9
0001(0002,0003)
0003(0004,0005)

ID      Class       Parent  Param#
0005    Thimbal     0003    2
0004    Needle      0003    1
0003    SewingKit   0001    2
0002    Soap        0001    1
0001    SuitCase    root    0


Where the id's of the parameters are listed in the columns along with the class names for each. So I could give the factory id0001 and it would create 0002-0005 automatically.


Does that make sense as an approach? I have a DI chain the is created anew every few seconds. All the thousands of chains are stored in a database.


The factory aspect is already provided by QxOrm as below. I need to figure out how to recursively build and link all of dependencies. Because it doesn't seem to allow constructor arguments, this would need to be done with setter injection, but I don't know how I would go about the recursive part, which is not part of QxOrm and is something I would need to roll myself.


Here is some info on the factory:

qx::QxFactoryX class is a part of introspection engine of QxOrm library and a kind of implementation of factory pattern.

Each class registered into QxOrm context can be instantiated using its name (and without knowing its C++ type) :

 
boost::shared_ptr ptr = qx::create("my_class");

Given this how do I approach the recursive resolution of all dependencies and passing all the pointers in to link it up?
Topic archived. No new replies allowed.