This is a development structure used in a small project last year. It is very simple, and there are not many skills. According to this structure, this small project runs well, and there are several major modifications later, this structure is outdated. At that time, in order to unify the members of the project teamCodeStructure, write this document. It does not play a major role in the hard disk and is shared for your reference.
I am not a master, but I think I am very real. It makes the project very stable, the customer is satisfied, the boss is happy, and weProgramThe staff are also happy. This is enough. I seldom study what Layer 3 is and what Layer 4 is. I don't think it is necessary to know clearly.
First, let's look at the system structure.
The system is divided into five projects, such.
Entity entity layer is used to represent business entities and can be used to transmit data in different software layers
Namespace htsystem. businessEntity
{
Public class flexuser
{
Private string employeecode;
Private string name;
Private string username;
}
}
Write these three fields first, right-click each field name, And refactor --> encapsulate the fields. This class is ready.
The data access layer is a public data access component of dataprovider, which is stable and easy to use.
To support other databases, although the company only uses SQL Server.
The service function layer calls the data access layer and entity layer to access the database.
Namespace htsystem. Service
{
Public class userdb
{
Const string singinsql = "select employeecode from employee where [username] = '{0}' and [Password] = '{1}' and signin = 1 ";
Public static bool signin (string username, string password)
{
String MySQL = string. Format (singinsql, username, password );
Idataprovider privider = dataprovider. createdataprovider ();
Object idx = privider. executescalar (MySQL );
Return idx! = NULL & idx. tostring (). Trim (). length> 0? True: false;
}
In the above Code, the static class returns the bool variable to determine whether the operation is successful.
Web applications directly call the service layer to execute functions
Bool ret = userdb. signin (username, password );
Common Features of utility are put here, such as encryption and decryption, and sending emails.
Namespace htsystem. Utility
{
Public class helper
{
Public static bool sendemail (string subject, string body)
{
}
}
Thank you for your correction.