This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product. Otherwise - post away!
this feature would be very useful for me too.
Actually one-to-many association generate a map with entities that are not JSON serializable due to their recursuve structure.
Let's imagine a A has many B relation between entities A and B. The tool generate a mapping where A entity has a collection of its Bs and at the same time every B holds an instance of its A. The problem is on the B side.
For me unidirectional mapping would mean that B don't have to hold a reference to A.
I think that the NHibernate Designer would improve very much with this feature. In my case for example I have schemas with a lot of these relations and I have to expose a lot of "A"s in JSON Rest web services. This force me every time after a code generation to manually deleted all the unwanted code related to the side of relation that i don't need (B towards A in this case).
Do you think this could be done?
Thank you very much!!
This will be going into the next nightly build. If you leave the collection name or backreference name blank, we won't emit a property or mapping for that end of the association. For example, if you have an arrow between Customer and Country, and you change the CollectionName from "Customers" to blank, then we will not generate the Country.Customers property or mapping. (And conversely if you change the BackreferenceName from "Country" to blank.)
Please try this out and let us know if you run into any bugs or surprises.
Solution with Unidirectional relations works if between "Customers" and "Country" is only one association. If there are two of them then error occurs.
I have two entities User and PaymentTransfer. I want to create two unidirectional associations:
PaymentTransfer.FromUser -> User PaymentTransfer.ToUser -> User
After one-to-many assocciation is created I remove CollectionName. Error message says that you cannot create two associations with name '' (empty string).
I use Mindscape.NHibernateModelDesigner-20150409
Do you have any idea how to solve this?