Inverse option for 1:many relationships
Inverse option for 1:many relationships
Just a quick question, hopefully.
When you define a one-to-many relationships, why is there an option to disable "inverse" on the many-side of the relationship?
As far as my understanding of NH, with a one-to-many relationship resulting in two "relationship definitions" in terms of the generated HBM mappings, the "inverse" option should always be used on the reverse relationship, since, the way the schema is generated, the many-side is always the "owner" of that relationship, since that's where the foreign key is located in the schema.
Is there a real use-case for a one-to-many where the many-side is not "inverse"?
The only use-case I can think of, is a one-to-many where the one-side isn't generated.
If that is the only use-case, why doesn't the "generate" setting simply drive the "inverse" property? At least, it could automatically set the "inverse" property to the most likely default, or not?
When you define a one-to-many relationships, why is there an option to disable "inverse" on the many-side of the relationship?
As far as my understanding of NH, with a one-to-many relationship resulting in two "relationship definitions" in terms of the generated HBM mappings, the "inverse" option should always be used on the reverse relationship, since, the way the schema is generated, the many-side is always the "owner" of that relationship, since that's where the foreign key is located in the schema.
Is there a real use-case for a one-to-many where the many-side is not "inverse"?
The only use-case I can think of, is a one-to-many where the one-side isn't generated.
If that is the only use-case, why doesn't the "generate" setting simply drive the "inverse" property? At least, it could automatically set the "inverse" property to the most likely default, or not?
Here are cases when Inverse=True should be used:
http://www.nhforge.org/doc/nh/en/index. ... -onetomany
http://www.nhforge.org/doc/nh/en/index. ... irectional
http://www.nhforge.org/doc/nh/en/index. ... ypes-bidir
By default, Inverse is set to False - we consider this behaviour as correct.
http://www.nhforge.org/doc/nh/en/index. ... -onetomany
http://www.nhforge.org/doc/nh/en/index. ... irectional
http://www.nhforge.org/doc/nh/en/index. ... ypes-bidir
By default, Inverse is set to False - we consider this behaviour as correct.
From the section on bi-directional associations:
So I still don't understand why marking one side of a bi-directional one-to-many as inverse is optional in ED - I don't think it's allowed? (or if it is allowed, it must be a pretty exotic case - I don't think I've seen an example where such a configuration was required, so it's a bit hard to understand why it would be the default... for many-to-many relationships, marking one end as inverse is enforced by ED.)
It's my understanding that one end of any bi-directional relationship, as a rule, should be set as inverse.The non-inverse side is used to save the in-memory representation to the database. We would get an unneccessary INSERT/UPDATE and probably even a foreign key violation if both would trigger changes! The same is of course also true for bidirectional one-to-many associations.
So I still don't understand why marking one side of a bi-directional one-to-many as inverse is optional in ED - I don't think it's allowed? (or if it is allowed, it must be a pretty exotic case - I don't think I've seen an example where such a configuration was required, so it's a bit hard to understand why it would be the default... for many-to-many relationships, marking one end as inverse is enforced by ED.)
New build of Entity Developer 4.2.129 is available for download now!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23375 .
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23375 .
Re: Inverse option for 1:many relationships
You're over a year late with these updates, folks - I have long since moved on and no plans to ever use this software again.
Re: Inverse option for 1:many relationships
Build 4.2.129 with the functionality you had requested was released on February 9, 2012: http://www.devart.com/entitydeveloper/r ... story.html.mindplay wrote:You're over a year late with these updates
Re: Inverse option for 1:many relationships
I see the date on the post, yes - very strange. I received this and five other e-mail notifications yesterday, a year after you posted them, so maybe you've got a problem with your forum...
Re: Inverse option for 1:many relationships
There were a lot of spam posts (which have already been removed) at out forum in different threads. Most likely you received notifications about spam posts.