Suppose I have two entities: User
and UserGroup
.
They have a one-to-many relationship => each UserGroup
virtually contains 0 to n number of users.
If I want to retrieve the users for a UserGroup
where in my business layer would be a better class to put that method?
- In
UserManager
, add method:GetAllUsersForUserGroup
- in
UserGroupManager
add the above method.
Guess 2 is better. But I'm not sure.
Thanks.
UPDATE
Guess I couldn't completely explain what I meant.
Yes we can have User
, Users
, Group
, Groups
, etc.
But I'm not trying to find out what different patterns, etc can be applied to implement the business. my question is: do you put GetAllUsersForUserGroup(int UserGroupID)
in UserManager
or in GroupManager
? Do you think GetAllUsersForUserGroup(int UserGroupID)
should be defined in a class that is managing users or in a class that's managing user groups?