O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Types of mapping

When using NHibernate as our ORM framework, we can identify four main types of mappings:

  1. XML-based mapping.
  2. Attribute-based mapping.
  3. Fluent mapping.
  4. Convention-based mapping, sometimes also called auto-mapping.

The following section will explain the main concepts behind these different ways of mapping the domain to an underlying database.

Tip

There also exist some OSS and commercial tools that provide the possibility to visually design the mapping between the domain and the underlying database schema. However, this approach is outside the scope of this book.

XML-based mapping

Each type of the model is mapped with an XML document to a table in the database schema. The structure of this XML document is defined in the nhibernate-mapping.xsd ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required