what does inverse and cascade means in NHibernate

2019-02-12 16:58发布

问题:

I'm learning Fluent Nhibernate and my question is:
What does Inverse mean? I read that it means that the other side of the relationship is responsible for the saving, and so does Cascade,

Can someone please explain what are the differences between them? Please explain in details because I'm a newbie at NH.

回答1:

Have a look at this text (link down, here's a mirror on archive.org), the "inverse" attribute is explained in detail.

The different cascade options are well explained by Ayende himself in his blog.

A good and recommended read is "NHibernate in Action", while not an easy text, this will cover a lot of your questions.



回答2:

I found an explanation when Inverse = false is necessary. If I want a Parent with collection of "children" and in the child object there won't be a reference to the parent.
so you do Has many on the parent add inverse = false and not adding the reference in the child.