Active record pattern

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m
m (Example)
 
Line 8: Line 8:
  
 
=Example=
 
=Example=
TBC
+
[[Image:active_record.png]]

Latest revision as of 21:24, 17 October 2010

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