2009年1月30日星期五

Re: [fw-mvc] Re: Separating Models from DB Access

OK, think I'm getting my head round this now :-) . So, my "gateway" is
actually a data mapper, and that is used to hide the domain objects
from the DB and vice-versa. A script will access the mapper, request a
Site object, the mapper will do all the DB work, create a Site object
from the data and then return that object. When the object has been
updated and the changes need to be saved back to the DB the object is
parsed back to the mapper, which again takes care of the DB work.

The DB knows nothing about the mapper or the domain objects.
The domain objects no nothing about the mapper or the DB.
The mapper knows about both the DB and the domain objects.

Am I on the right lines?

没有评论: