I am busy with a project where I will be implementing a tree structure for relating objects to one another. I found a great article describing the logic and coding for a non-binary tree: Tree<T>: Implementing a Non-Binary Tree in C#. I see this as a good implementation.
My question, however, relates to the fact that I am wanting to develop this using a Domain Driven Development approach. So, what comes up in the design process is how will my combined domain model of the tree and my other objects equate to a data persistence model?
Because the Tree implementation uses generics, the domain object which stored the data will be oblivious to the fact that it is a part of the tree. So I am struggling to get my mind around how this will equate to data retrieval and persistence using a repository pattern and nhibernate, for example.
My initial thinking is that I would need to implement a very specific custom repository that would handle the traversal of the tree and persistence thereof. However, it is quite hazy at the moment.
Is there anybody out there who has done something like this and can share their experience or offer some code?
I found an interesting post in the NHibernate FAQ which I think may help in clearing the mist on this topic. If you are interested, check this out: How to map a tree in NHibernate