Active record pattern

From CSSEMediaWiki
Jump to: navigation, search

An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.

How it works

An object is directly related to the row in a table or view. It is very similar to the Row data gateway pattern except that it contains the behavior of the object (as well as the data).

When to use it

Simple objects with simple business rules.

Example

Active record.png

Personal tools