A Sample 4 Tier Application Design
1. Presentation Layer (Asp.Net / Win Forms/ Pocket PC UI.)
This predominantly contains User Controls, Custom Controls and Win/Web
I have one base form and I inherit from that form.
All validation is done in this tier. There is zero Data Access code in this
tier. This tier exclusively gets DataViews/ Arays/Lists as input.
Explicit calls to BusinessLayer is required.
2. Business Layer.
Currently this is just a Library residing in the same machine as
Presentation layer. Eventually I plan to use WebServices if application
needs physical seperation.
Most of Business Logic are implemented in this layer. There is absolutely no
UI code here.
Based on the Business rules explicit SQL statements or Stored Procedure calls are created here. All the parsing of datasets and other logic operations are performed here.
Output are string objects with SQL Statements or just parameters with
data connection key.
3. Data Access Layer.
These are all bunch of static methods which perform CRUD functionality.
All methods are atomic in nature. I dont rely on Static Variables. There is
just one DatabaseLayer class which does all the functionality.
All functions just have 2 parameters, SQL/Stored Procedure and DataConnection Key. Return parameter might vary based on the function called.
4. Database SQL Server