I write my own computer room, look at a lot of high-level blog, all kinds of reference, the first must be tangled, now the entire room knocked out, write this blog to everyone a whole, simple understanding of the seven layer, expect you to read this article, will not this tangled.
First of all, you have to read my last blog:
http://blog.csdn.net/qiumuxia0921/article/details/33738319
I will say a little more, as long as you understand the package map.
First, I'll start with the oldest, simplest, first example, login:
1. We need to know which steps login is required: Query the user table to determine whether the users exist or add a user log in the Worklog.
2, the need of database design:
I'm not going to build a table here, so everybody's looking more familiar, right?
3. Establishment of entity
Entities are built on a table, that is, there are several fields in the table, and the loginentity and worklogentity classes of the entity have several property.
In the principle of all-encompassing, I will bask in the code, we do not bother me:
' ************************** ' file name: Userlogin ' namespace: Entity ' content: ' function: ' File relationship: ' Author: Qiu Xia ' group: Qiu Xia ' date generated: 2014-06-07 17:27: 28 ' version number: V1.0.0.0 ' Modify log: ' Copyright note: ' ***************************public Class loginentity#region ' define variable ' Private _userid as Stri ng private _level As String private _head as String private _password as String private _oldpassword as String Private _username As String private _computer as String#end region public Shared Userhead As String ' Set global variable public Shared UserLevel As String public property UserID () As String ' to pass every entity in the T_user_dal table, the entity is built from a table, not a function Get Return _userid End get Set (ByVal value as String) _userid = VA Lue End Set End Property public Property level () as String get Return _level End get Set (ByVal value as String) _level = value End Set End Property Public Property Head () as S Tring Get Return _head End Get Set (ByVal value as String) _head = value End Set End Property Public Property Password () as String Get Return _password End get Set (ByVal value as St Ring) _password = value End Set End Property Public Property OldPassword () as String Get Return _oldpassword End Get Set (ByVal value as String) _oldpassword = value End S Et End Property Public Property UserName () as String get Return _username End get Se T (ByVal value as String) _username = value End Set End Property Public Property computer () as Stri ng get Return _computer End Get Set (ByVal value as String) _computer = value End Set End Propertyend Class
The above is loginentity, the following is Worklog:
' ************************** ' file name: Worklogentity ' namespace: ' Entity ' content: ' function: ' File relationship: ' Author: Qiu Xia ' group: Qiu-Summer ' build Date: 2014/6/15 11: 07:47 ' version number: V1.0.0.0 ' Modify log: ' Copyright note: ' ***************************public Class worklogentity Private _userid as String Pri Vate _level As String private _logindatetime as String private _logoutdatetime as String private _computer as Str ing Private _status As String public Shared property Login_datetime As String Public property UserID () As String Get Return _userid End get Set (ByVal value as String) _userid = value En D Set End Property, level () as String get Return _level End get Set (B Yval value as String) _level = value End Set End Property Public Property Logindatetime () as Strin G Get Return _logindatetime End Get Set (ByVal value as String) _logindatetime = Value End Set End Property Logoutdatetime () as String get Return _logoutdatetime End get Set (ByVal value as String) _logoutdatetime = value End Set End Property public property Compu ter () As String get Return _computer End get Set (ByVal value as String) _comput ER = value End Set End Property Public Property Status () as String Get Return _status End Get Set (ByVal value as String) _status = value End Set End Propertyend Class
What I want to say here is the global variable in loginentity, the global variable is the system as long as it assigns its value, he will die with the program, so there is no need to worry about when it will be nothing.
All of these are preparatory work, because of the space, see next article.