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

Different mechanisms to write the mappings


NHibernate has at least three different mechanisms for mapping persistent classes to database tables. This is both good and bad. While you can choose the one that you are most comfortable with, this can also leave you confused at times. Two of the mechanisms are natively supported by NHibernate library and one is an external implementation. In this section, we would look at all the three mechanisms briefly, before proceeding to implement mapping for our employee benefits problem. Though there are three different ways of expressing entity mappings, keep in mind that the core of the mapping engine is same, no matter which way you express your mappings. For all the mapping discussions in this chapter, I plan to express mappings using all the three methods in most of the cases. That way you will get a feel of how expressive each method is. It would not harm to stick to one method and ignore the others but remember that XML mappings are most complete...