what does inverse and cascade means in NHibernate

2019-02-12 16:01发布

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.

2条回答
来,给爷笑一个
2楼-- · 2019-02-12 16:52

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.

查看更多
Root(大扎)
3楼-- · 2019-02-12 16:59

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.

查看更多
登录 后发表回答