Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Choosing the right mapping method


Knowing more than one way of declaring NHibernate mapping may sound good but it may also be confusing. It is important to have knowledge of different methods of mapping but it is equally important to be able to choose the right method that best fits the bill, given a particular job. So how do you go about choosing the right mapping method?

If I am working on a green-field project, then my default stand is to use FNH. This is mainly because there is no legacy database or legacy domain model that I need to work with. So basically, I get all the freedom to define the best domain model that suits my business requirements and then use NHibernate and FNH to drive the design of database from there. This works quite nicely though FNH lacks few mapping features. FNH is most effective when used with auto-mapping feature on. In this mode, I do not have to declare any mapping and FNH would intelligently decide the best mapping for me looking at the domain model. I have...