Controlling the Database Mapping

When you’re working with LightSpeed, you’re working at the level of .NET domain objects.  In the ideal world, the database would be transparent to you: objects would persist and could later be retrieved, but you wouldn’t need to know how or where that persistence happened.

In reality, of course, this doesn’t happen.  You may be working with an existing database, which you want to map into a more usable domain model.  You have to work with database administrators who have specific rules on how the database should be organised.  You may need to control which fields get persisted and which do not.  You may need to move some business logic into the database for performance reasons.

LightSpeed adopts a principle of convention over configuration, so that if you just define your domain model and do nothing more, it will be mapped to the database in a sensible way.  This chapter describes the default LightSpeed conventions, then goes on to describe how you can override those conventions to meet your particular requirements.

Understanding the Default Mapping

Overriding the Default Mapping

Overriding Persistence Behaviour

Identity Generation

Working with Database Views

Invoking Stored Procedures