Is a good idea to use self-referencing hierarchy in CSLA.NET?

Is a good idea to use self-referencing hierarchy in CSLA.NET?

Old forum URL: forums.lhotka.net/forums/t/11273.aspx


TF Zheng posted on Sunday, April 01, 2012

In CSLA.NET, Is a good idea, or proper approach, to use self-referencing hierarchy from one  data-table to build object graph (Parent-Child)?

tiago replied on Sunday, April 01, 2012

Hi TF Zheng,

CSLA.NET offers no direct support for hierarchical data.

One of the approaches is to use a ReadOnly (root) collection where the ReadOnly child objects have a ParentID property. The hierarchy concept is moved out of business objects to UI. That might not be the best approach since the hierarchy is indeed a business concept.

TF Zheng replied on Sunday, April 01, 2012

Friend,

Each level of my hierarchical data is an editable list of business object with many properties. At least we have four levels in hierarchy. There are two approaches:

One approach is: Each level of business object maps to a data-table. Then, use "Has relation/Forieign-Key" to establish hierarchical object graph/view.

The another approach is: use self-referenceing table of hierarchy.

My question is: which approach is the best if we we use CSLA.NET together with Entity Framework?

Thanks for any suggestions...

TF Zheng

TF Zheng replied on Friday, April 06, 2012

Friend,

Each level of my hierarchical data is an editable list of business object with many properties. At least we have four levels in hierarchy. There are two approaches:

One approach is: Each level of business object maps to a data-table. Then, use "Has relation/Forieign-Key" to establish hierarchical object graph/view.

The another approach is: use self-referenceing table of hierarchy.

My question is: which approach is the best if we we use CSLA.NET together with Entity Framework?

Thanks for any suggestions...

TF Zheng

Copyright (c) Marimer LLC