entity - Persistence encapsulated via the domain, or persistence via the Repository? -


if domain model not supposed know/care repository, how behaviour .updateorder(...), encapsulates crud-update, interface repository? through domain service?

ok, repository has effective crud-update that's used in conjunction .updateorder(...). that's fine. don't want use update method on repository, want them go through behaviour on entity (use updateorder() instead). i'd prefer in likeness way domain model satisfies invariants - it's design (private set properties, etc) - repository not expose alternate method "updating"/persisting entity.

is access modifier problem solved me not having update method in repo public. or there 'better' answer? please me ddd ninjas.

the strict sequence in ddd be:

var entityrepository = myservicelocator.get<ientityrepository>(); var myentity = entityrepository.load(<some criteria>); myentity.change(something); entityrepository.save(myentity); 

the repository responsible detecting/persisting of changes within entity.

(btw, i'm assuming entity aggregate root)


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -