1

I have a schema that looks like this:

enter image description here

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 be 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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the links, it looks like I'll probably just have to map a Bar object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.