.net - Repository Pattern - aggregate root -
i trying head around aggregates roots lie in entity framework data model know repositories need create.
if talk in relational database terms second, have exceptiongroup object , exception object (not system.exception!). exception belongs exceptiongroup , cannot exist without exceptiongroup.
should have repository each object or single repository containing methods both? if have single repository methods follows...
findallexceptionsbyexceptiongroup(int groupid) addexceptiongroup(exceptiongroup exceptiongroup) - because exception cannot exist without group. addexception(dataaccess.exception exception) deleteexceptiongroupbyid(int groupid) deleteexceptionbyid(int exceptionid) deleteexceptionbygroup(int groupid)
if understand model correctly, sounds have repository exceptiongroup
, exceptiongroup
object encapsulate access , operations on exception
instances (for ex., exposing collection of them). in way, forced relationship between 2 classes becomes apparent.
jeff sternal has excellent answer similar question here: what's aggregate root? example of order / lineitem seems analogous.
Comments
Post a Comment