Fluent mapping

As already briefly discussed, fluent mapping is a technique where we use a framework that exposes a fluent API to define the mappings for our domain model. The fluent API makes a mapping very readable as there is no unnecessary code noise involved, such as angle brackets.

Fluent mappings are defined in C# and the framework makes heavy use of expression trees to allow us to define all details in a type-safe way without using magic strings. This makes tasks, such as refactoring entities, a breeze as tools such as Visual Studio or ReSharper can automatically refactor the affected mapping files too.

Expression trees – please explain

When Microsoft introduced LINQ for .NET 3.5, it had to first create the necessary infrastructure. LINQ heavily ...

Get NHibernate 3 Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.