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

Fluent mapping a.k.a. Fluent NHibernate


If you have liked mapping by code and are excited about being able to declare mappings programmatically, then I am sure you would fall in love with fluent mappings offered by Fluent NHibernate (FNH). As far as I can tell, fluent mapping is the most widely used technique of mapping in NHibernate world and we will see why everyone likes it so much.

FNH scans your code based on mappings, processes them, and comes up with appropriate XML mappings. All this process is transparent to you as developer. But it is useful to remember that all FNH is doing is transforming code-based mappings into XML mappings.

Before we start writing fluent mappings for our classes, let me tell you that FNH, for some reasons, chose to name their APIs differently than their XML or mapping by code counterparts. For example, property mapping in FNH is named Map. This could be a cause of confusion if you are new to FNH but I'm sure your love for FNH would outweigh the confusion and...