开发者

Vb.net project with c# fluent nHibernate mappings project

Having successfully tried out nHibernate, I would now like to try using Fluent for mapping. My main project is in vb.net but I would really like to u开发者_StackOverflow中文版se c# for the mappings since the lambda expression capability makes it much cleaner. Can you have a separate project/assembly for your mapping files without creating a circular dependency with domain objects?


Can you have a separate project/assembly for your mapping files without creating a circular dependency with domain objects?

Yes, your domain objects are not (and should not be) dependent on the NHibernate mappings, whether they be defined the traditional way (.hbm.xml files) or with Fluent. You can safely store these mappings in another assembly, and they only need to be referenced by your data access layer (DAL) and your executable project. Since your domain objects don't need a reference to your DAL, it works just fine.

Just follow the instructions at Fluent's Wiki and in the same assembly where you defined your CreateSessionFactory() method, you'll need a reference to your mapping project.

-Doug

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜