以这个简单的,人为的例子:存储库,服务或域对象 - 逻辑属于哪里?
UserRepository.GetAllUsers(); UserRepository.GetUserById();
不可避免的是,我将有更多的复杂的“查询”,如:
//returns users where active=true, deleted=false, and confirmed = true
GetActiveUsers();
我无法确定在何处存储库的责任结束。 GetActiveUsers()代表一个简单的“查询”。 它是否属于版本库?
怎么样的东西,包含一点点逻辑的,如:
//activate the user, set the activationCode to "used", etc.
ActivateUser(string activationCode);
回应你最后一段:如果“坚持改变”是唯一的逻辑。例如ActivateUser()仅更新User表中的一条记录和ActivationCode表中的一条记录。这是否构成“逻辑”?如果不是,那是什么? – betitall 2010-06-06 01:46:14