Working with Legacy Databases

LightSpeed is primarily designed around a ‘convention over configuration’ approach, in which your code maps naturally to your database schema.  In a greenfield application, this produces simple, well normalised database schemas that are well aligned with the domain code, in accordance with the principle of a ‘ubiquitous language’ used across the system.  When you have an existing database, though, you may not be able or willing to modify the database to follow LightSpeed’s conventions, because of technical risk, compatibility constraints with other applications or simple lack of time.  This chapter describes some techniques for working with such databases using LightSpeed.

Invoking Stored Procedures

CRUD Stored Procedures

Using Natural Keys

Using Composite Keys

Mapping Database Types to Domain Types