Active record pattern
From CSSEMediaWiki
(Difference between revisions)
m (New page: ''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...) |
m (→Example) |
||
(One intermediate revision by one user not shown) | |||
Line 2: | Line 2: | ||
= How it works = | = 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). | + | 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 = | = When to use it = | ||
Line 8: | Line 8: | ||
=Example= | =Example= | ||
− | + | [[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.