Nhibernate Self Reference uni-directional

In my previous post we have seen to implement self reference (Bi-directional) . Today we will quickly see  how to achieve self reference uni-directional.


Lets take a simple scenario of a tree structure . One node can have many Children nodes but any child node will have only one parent.



Now  we do not have any mapping table because we want it unidirectional mapping. In database we have only one table Node . Lets see how to get  complete tree now ..

Above mapping will create the below realtion

You can refer below link for more details :


You can download complete implementation from here


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s