开发者

Mapping multiple tables into a single object with NHibernate

I have a schema that looks like this:

Mapping multiple tables into a single object with NHibernate

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜