Chapter 3. Writing and mapping classes
This chapter covers
- POCO basics for rich domain models
- The concept of object identity and its mapping
- Mapping class inheritance
- Association and collection mappings
The “Hello World” example in chapter 2 gave a gentle introduction to NHibernate; but we need a more thorough example to demonstrate the needs of real-world applications with complex data models. For the rest of the book, we explore NHibernate using a more sophisticated example application—an online auction system.
We start our discussion of the application by introducing a programming model for persistent classes.
First, you’ll learn how to identify the business objects (or entities) of a problem domain. You’ll create a conceptual model of these entities and their attributes, called a domain model. You’ll implement this domain model in C# by creating a persistent class for each entity, and we’ll spend some time exploring what these .NET classes should look like.