I am creating my first enterprise level solution (at least I'm trying to make it generally accepted). I'm trying to follow best practice design patterns, but I'm starting to worry that I might go too far with abstraction.
I am trying to create an asp.net webforms application (in C #) as an n-level application. I created a data access layer using a strongly typed XSD dataset that interacts with the SQL server backend. I access DAL through some business-level objects that I created on a 1: 1 basis for data in a data set (for example, for the UsersBLL class for data, data in a data set). I do checks inside the BLL to make sure that the data passed to the DAL complies with the business rules of the application. This is all good and good. Where I am stuck is the point where I connect the BLL to the presentation layer. For example, my UsersBLL class works mainly with integer data since it interacts with DAL. Should I now create a separate class "User" (Singular), which displays the properties of one user, and not multiple users? This way, I do not need to search through datatables in the view level, since I could use the properties created in the User class. Or would it be better to somehow try to handle this inside UserBLL?
Sorry if this sounds a little complicated ... Below is the code from UserBLL:
using System; using System.Data; using PedChallenge.DAL.PedDataSetTableAdapters; [System.ComponentModel.DataObject] public class UsersBLL { private UsersTableAdapter _UsersAdapter = null; protected UsersTableAdapter Adapter { get { if (_UsersAdapter == null) _UsersAdapter = new UsersTableAdapter(); return _UsersAdapter; } } [System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, true)] public PedChallenge.DAL.PedDataSet.UsersDataTable GetUsers() { return Adapter.GetUsers(); } [System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, false)] public PedChallenge.DAL.PedDataSet.UsersDataTable GetUserByUserID(int userID) { return Adapter.GetUserByUserID(userID); } [System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, false)] public PedChallenge.DAL.PedDataSet.UsersDataTable GetUsersByTeamID(int teamID) { return Adapter.GetUsersByTeamID(teamID); } [System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, false)] public PedChallenge.DAL.PedDataSet.UsersDataTable GetUsersByEmail(string Email) { return Adapter.GetUserByEmail(Email); } [System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Insert, true)] public bool AddUser(int? teamID, string FirstName, string LastName, string Email, string Role, int LocationID) {
It would be helpful to evaluate some recommendations in the right direction!
Thanks everyone!
Max
max
source share