c # – Using the repository pattern

First of all, I hope that adding Bal (Business Access Layer) and Dal (Data Access Layer) to the name of the classes is just a sample. Because it's really bad name convention, I think. Its layer name is enough to understand it.

And for your question, exactly what you need to do is create UserTypeRepositoryDal Y UserTypeBal. As you think, if you do not, you can not get the list of user types directly or add another class and this would be against the Principle of Single Responsibility (SRP). In addition, each development on Type of user will not be placed in the appropriate class.

Beyond this, you can add public UserType UserType {get; set; } in User entity there is even FK_UserType. This is a good way to manage 1-1 or 1-n relationships. It seems that :

public class user
Public ID int {get; set; }
Name of the public string {get; set; }
public int FK_UserType {get; set; }
public UserType UserType {get; set; }

You can load Type of user in User object using FK_UserType. If you use ORM as an Entity Framework, it can do it for you.

In this way it is appropriate to administer 1-1 and / or 1-n relationships. If you have an n-n relationship, then you need the relationship table and its Bal and Dal classes.

Also, the design of your repository and its feature class should not depend on whether or not you use the store's procedures.