Hi,
Suppose you have a class named MyClass
. MyClass
should have a property named Parent
, Parent
must be of type MyClass
itslef. It is necessary because MyClass
wants to hold a tree structure.
How can it be done?
Hi,
Suppose you have a class named MyClass
. MyClass
should have a property named Parent
, Parent
must be of type MyClass
itslef. It is necessary because MyClass
wants to hold a tree structure.
How can it be done?
It's pretty straightforward:
[ActiveRecord(Lazy = true)]
public class MyClass {
[BelongsTo]
public virtual MyClass Parent { get;set; }
}
You might also want to map the collection of children.
See these articles for more information on how to run recursive queries over this: