I have a schema that looks like this:
There is a one to one relationship between Foo and Bar and a many to one relationship between Bar and Baz.
I have Foo and Baz mapped to separate objects, but I'm not sure how to go about linking them using Bar, without making Bar a separate object. (I want to b开发者_StackOverflow中文版e able to access Baz as a property of Foo)
It looks like it should be possible as it's very similar to the example given here, except using a many-to-one relationship instead of a property.
I'm not sure that you will be able to accomplish what you want using a join. You'll end up with problems trying to join Foo and Bar. See these 2 articles:
Fluent NHibernate join tables in mapping not using primary key
Fluent NHibernate join for property value
I'm not sure there is a great way around this without making bar an entity.
精彩评论