views:

250

answers:

1

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 use 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?

+4  A: 

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

Doug