A doubt about 3 tire architecture.
-
My boss told me to design a 3 tire architecture application. I am using C# asp.NET 2005. Since I don't have much idea about the 3 tire architecture, I designed one based on articles found in net. I don't know how much perfect it is. So I like to hear your opinion. I designed it like this. I created a class library project for data layer named 'DL'. It contains 2 classes. First one is 'DLCommon', which is to declare protected variables of SqlConnection, SqlCommand, SqlDataAdapter est. Its constructor will read and store the connection string in a variable from the config file. The second class is 'DL', which drived the 'DLCommon' class. This class contains the functions to open database, excute sql and stored procedure. Its constructor will open the connection and store in a SqlConnection variable until the object is destroyed. I created another class library for business layer named 'BL'. This project has several classes. Each class is used to write functions for a particular set of operations. For example I created a class in 'BL' named 'clsUser', which is to write functions for add, edit, and delete the users. These class using a variable of 'DL' class for database operations. The presentation layer is a web project which using the variables of the classes in the business layer project.
Thomas
-
My boss told me to design a 3 tire architecture application. I am using C# asp.NET 2005. Since I don't have much idea about the 3 tire architecture, I designed one based on articles found in net. I don't know how much perfect it is. So I like to hear your opinion. I designed it like this. I created a class library project for data layer named 'DL'. It contains 2 classes. First one is 'DLCommon', which is to declare protected variables of SqlConnection, SqlCommand, SqlDataAdapter est. Its constructor will read and store the connection string in a variable from the config file. The second class is 'DL', which drived the 'DLCommon' class. This class contains the functions to open database, excute sql and stored procedure. Its constructor will open the connection and store in a SqlConnection variable until the object is destroyed. I created another class library for business layer named 'BL'. This project has several classes. Each class is used to write functions for a particular set of operations. For example I created a class in 'BL' named 'clsUser', which is to write functions for add, edit, and delete the users. These class using a variable of 'DL' class for database operations. The presentation layer is a web project which using the variables of the classes in the business layer project.
Thomas
Sounds ok Normally you have a 3 tire Architecture to isolate things from each other UI - User Interface BL - Business lauer where you have all your business logic DAL - Data access layer where the database acces is in IO recommend you to also have a look on O/R mappers and specially Castle where you in your BL add some properties to your code and the O/R mapper is taking care of the mapping to the database Getting started article http://www.castleproject.org/activerecord/gettingstarted/index.html
Magnus Sälgö Sälgö Consulting AB, Sweden
-
My boss told me to design a 3 tire architecture application. I am using C# asp.NET 2005. Since I don't have much idea about the 3 tire architecture, I designed one based on articles found in net. I don't know how much perfect it is. So I like to hear your opinion. I designed it like this. I created a class library project for data layer named 'DL'. It contains 2 classes. First one is 'DLCommon', which is to declare protected variables of SqlConnection, SqlCommand, SqlDataAdapter est. Its constructor will read and store the connection string in a variable from the config file. The second class is 'DL', which drived the 'DLCommon' class. This class contains the functions to open database, excute sql and stored procedure. Its constructor will open the connection and store in a SqlConnection variable until the object is destroyed. I created another class library for business layer named 'BL'. This project has several classes. Each class is used to write functions for a particular set of operations. For example I created a class in 'BL' named 'clsUser', which is to write functions for add, edit, and delete the users. These class using a variable of 'DL' class for database operations. The presentation layer is a web project which using the variables of the classes in the business layer project.
Thomas
Your concept looks OK, but if your are really going to name classes DL and BL you are looking for trouble.
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham My New Blog