His Architecture
Dao
Bll
Entity idao
Web
I personally think that BLL idao should be separated as a project. In this way, the hierarchy is clearer.
Dao implements the idao interface. Bll contains entity classes and corresponding business logic classes, plus an object factory class.
Public Bool Signin () {
// Validate input
If (Userid. Trim () = String . Empty) | (Password. Trim () = String . Empty )) Return False ;
// Try to sign in with the given credentials
Return (Isignondao) objectfactory. getinstance ( " Signondao " ). Signin ( This );
}
The above method shows how the signon object logs on to the system.
Use the object factory to obtain the DaO instance, convert it into an excuse, and call the corresponding login method.
The object Factory
Using System;
Using System. Web;
Using Spring. context;
Using Spring. Context. Support;
Namespace Petshop. BLL {
Public Class Objectfactory {
Private Static Iapplicationcontext CTX;
Static Objectfactory () {
CTX= NewXmlapplicationcontext ("Assembly: // petshop. Dao/petshop/objects. xml");
}
Public Static Object getinstance ( String Name) {
ReturnCTX. GetObject (name );
}
}
}
A static constructor is used to initialize the petshop. Objects. xml file of the petshop. Dao project. These classes have been initialized.
There is also a static method to return the object corresponding to the name.
Sprint.net