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

XML mappings for the Employee class


Learning mapping through documentation may not be the best experience for beginners. What can work better is using one of the classes from our domain model as an example and guiding you through the mapping exercise. That is exactly what we are going to do in this section. We will begin our journey with writing XML mapping for the Employee class.

The Employee class has some attributes of primitive type as well as collections and associations to other classes. To keep things simple in the beginning, we will first look at mappings of the primitive attributes of the Employee class and not the associations to the other classes. The objective is to understand how to declare simple mappings before we start handling complex scenarios.

Before we start mapping, I would like to talk about making the development environment ready for XML mapping and NHibernate in general. What I mean by that is ensuring that we have projects in place, third-party libraries installed...