Repository, Service or Domain object - where does logic belong?
Posted
by betitall
on Stack Overflow
See other posts from Stack Overflow
or by betitall
Published on 2010-06-04T22:14:47Z
Indexed on
2010/06/06
18:42 UTC
Read the original article
Hit count: 251
Take this simple, contrived example:
UserRepository.GetAllUsers(); UserRepository.GetUserById();
Inevitably, I will have more complex "queries", such as:
//returns users where active=true, deleted=false, and confirmed = true
GetActiveUsers();
I'm having trouble determining where the responsibility of the repository ends. GetActiveUsers() represents a simple "query". Does it belong in the repository?
How about something that involves a bit of logic, such as:
//activate the user, set the activationCode to "used", etc.
ActivateUser(string activationCode);
© Stack Overflow or respective owner