I know that the answer to my question may include choosing a specific approach, but I'm trying to explain what I'm trying to find out with details:
Consider a simple three-layer application (DAL, BLL, PL).
DAL uses EF 4.1 Code-First, and data access ends in the repository.
Right now, in BLL, I have Manager classes. (e.g. UserManager , ProductManager ) that all get from BaseManager . Almost every method in my Manager classes accepts a related object as a parameter and performs the corresponding operations on it. for example, in the UserManager (Pseudocode):
public bool AddPermission(User user, PermissionItem permission) { this.repository.Add(permission); this.save(); }
Question: My manager classes do not have to be created. they can be defined as static. But if I define them static, I have to create my common methods and members (e.g. repository and several other members) in each class (I don't want to define elements such as a repository, like static).
So, you suggest me to change the manager classes that really should be static for static classes? or is it ok to use them like them?
source share