Bidirectional one-to-many associations with indexed collections at NHibernate

Last summer, I asked a question about how to add a new object to IList, mapped as one-to-many with NHibernate . One of the answers allowed me to jump to this paragraph in the documentation :

Please note that NHibernate does not support bidirectional one-to-many associations with an indexed collection (list, map or array) as a "large" end, you should use a set or sum display.

Although I'm sure I understand what this paragraph says, I have no idea why and how to get around this limitation. Since I am now working again with a model that seems to require a one-to-many "bidirectional relationship" with a collection of indexes, "I decided that the time was right for the following questions:

  • Why does NHibernate have this association restriction? It seems to me that the guys behind NHibernate are pretty smart, so I guess there's a pretty good reason.

  • What are the common workarounds for this drawback? Creating a collection of non-indexed package and adding an explicit property Positionto the child class? Any better solutions?

+5
source share
1 answer

4 , , : -)

: .

, Invoice Lines IList<Line>.

line.Invoice = anInvoice , , .

, NHibernate "" ( inverse="true" , )

- , : Position/Index/etc .

+5

All Articles