Is anyone familiar with a compositions using llblgen?
I want to get the tree of nodes from a given starting node.
As you can see below, I tried to use a filter, but in that case I only get one node, without the StartNodeId I always get the conplete list.
Is llblgen capable to use this form of recursion?
Does anyone know how to get a tree from the given starting node?
(Using LlblGen V3.0)
TableStructure: DossierStatus
- StateId (PK) (not null)
- StateName (not null)
- StateParent (FK --> pointing to other PK in the same table) (null)
TableContents:
1, "State1", NULL
2, "State 2", 1
3, "OtherState", 1
USED CODE:
public IEntityCollection2 GetTree(int StartNodeId)
{
// Prepare the result collection
IEntityCollection2 nodes = new EntityCollection<DossierStatusEntity>();
// Create an EntityCollection of node entities and attach a context:
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
// Filter doesn't help here
//IRelationPredicateBucket filter = new RelationPredicateBucket();
//filter.PredicateExpression.Add(DossierStatusFields.StatusId == StartNodeId);
// Use a prefetch path to populate the node.Children collection of each node:
PrefetchPath2 path = new PrefetchPath2((int)EntityType.DossierStatusEntity);
path.Add(DossierStatusEntity.PrefetchPathDossierChild);
// Fetch all menu items:
adapter.FetchEntityCollection(nodes, null, path);
}
return nodes;
}