c# - Domain driven design methods in aggregate -
this question has answer here:
my question in regards following:
if have class manages users, lets call usermanager
. should responsible updating users in database (something registeruser
, updateuser
methods uses repository interface) in scenarios new user registers or updates profile?
i think task can delegated class. usersubscription
class handles calls(events) related userrepository
. imagine usersubscription
class of having methods (lets call them updateuser
, subscribeuser
) recieves valueobject
usermanager
class , uses them update or register users. think usersubscription
, usermanager
classes in same aggregate in application layer.
i think might looking repository pattern:
mediates between domain , data mapping layers using collection-like interface accessing domain objects.
a repository's responsibility should loading / storing / updating users (in database / other storage) in generic way. see repository pattern step step explanation more details.
if usermanager this, should userrepository instead. however, if usermanager's tasks different, should use userrepository handling storage of users.
Comments
Post a Comment