lundi 23 novembre 2015

How to implement business rules at each node in a self hierarchical tree structure

In a self hierarchical tree like structure, I would like to check for business rules(based on node type) at each node level on every node addition/edition/deletion. I tried implementing composite design pattern but no luck. Please suggest.

Sample class structure.

class Parent
{
    int Id;
}

class ChildType1 : Parent
{
    string propForType1;
    List<Parent> ListOfChildren;
}

class ChildType2 : Parent
{
    string propForType2;
    List<Parent> ListOfChildren;
}

Aucun commentaire:

Enregistrer un commentaire