Can you explain the reason for using inverse=”true” attribute in relationship mapping in NHibeernate with an example that requires the need of this attribute to be ‘true’ ?
Can you explain the reason for using inverse=true attribute in relationship mapping in NHibeernate
Share
If you have a bidirectional association, then from .net side, you must code both sides. Like
however from nhibernate perspective this will send 2 update statements by default for each of the lines. What you want is only to update ParentId column of the Child table. Inverse = true makes sure that changes made to that part doesn’t cause any changes in DB. So if you use Inverse = true and just write the below
nothing will happen in the db since that is the inverse side.