A small project development structure

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.