开发者

Fluent NHibernate table per subclass inheritance mapping

I'm new to NHibernate and Fluent NHibernate. I'm wondering how to properly use Fluent NHibernate with the "table per subclass" mapping strategy.

This is an example of what I'm after. More specifically though, I need a way to break the subclass mappings into separate files.

Also, when adding records, I need NHibernate to first insert into the parent, then into the child. Below is a simplified prototype of my database. Personnel, Images, and Projects should all inherit from Entities. Entities is responsible for generating the primary key. PersonnelId, ImageId, and ProjectId all have foreign keys referencing EntityId.

Hope that makes sense, thanks in 开发者_StackOverflow中文版advance.

alt text http://img695.imageshack.us/img695/6112/databasediagram.jpg alt text http://img693.yfrog.com/img693/4980/databasecolumns.jpg


There's a link at the top of the article you referred to which contains updates for the latest version of Fluent NHibernate, specifically those for separating subclass mappings into separate files. Updates to subclass and joined subclass mapping in fluent nhibernate 1.0RC.

Also, you should read the Fluent NHibernate wiki on the subject of subclasses.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜