Chapter 9. Writing real-world domain models

 

This chapter covers

  • Domain-model development processes
  • Legacy schema mapping
  • Understanding persistence ignorance
  • Implementing business logic
  • Data binding in the GUI
  • Obtaining DataSets from entities

Having read this book so far, you should be familiar with what a business entity looks like, what a domain model is, and roughly how a domain model is formed. Our examples have aimed to keep things simple, so we haven’t yet introduced you to the processes and techniques that will help you tackle real-world projects.

The first part of this chapter looks at the various starting points of an NHibernate project and then explains how you can leverage automation and generation to help build the other layers. Until now, you’ve been manually implementing entities by hand. You can save much time by using the tools described here to automatically generate domain-model entities, database schema, and even mapping definitions.

One particularly tricky starting point is a legacy database that you can’t change. Fortunately there are many mappings explained in this chapter that are especially useful in that scenario.

9.1. Development processes and tools

9.2. Legacy schemas

9.3. Understanding persistence ignorance

9.4. Implementing the business logic

9.5. Data-binding entities

9.6. Filling a DataSet with entities’ data

9.7. Summary