Duwamish 7 Preliminary - Data Process

xiaoxiao2021-03-06  80

DUWAMISH 7 is a Microsoft's distributed application example based on ASP.NET.

I have to study one or two due to work. I have a personal experience, I don't dare to share it, so I share it with the public. One and discuss ASP.NET, Wan Wang people will be enlightened,.

BTW has a structure and process in MSDN.NET, and I summarize my experience on this basis, and do a supplement on it. If you have any questions, you can check it.

Duwamish's core file:

SystemFramework / ApplicationAnssert.cs // Verify data legitimacy

SystemFramework / ApplicationConfiguration.cs // Defines the framework of the read and write configuration

Common / duwamishconfiguration.cs // Read and write configuration (via ApplicationConfiguration)

The above is the core of the entire application, and there is an ApplicationLog.cs, the role and configuration.

Web / web.config // application configuration file

Web / pagebase.cs // Web Forms page Base class for ASPX derived, define data that requires page sharing (such as user, order information, definition with attribute)

Web / modulebase.cs // web control base class for module / *. ASCX derived, defined all of the application paths and other shared information required for all modules (definitions with attributes)

Duwamish 7 is a small application (relative to more business applications), but Microsoft still defines its structure, framework, and hierarchy, making it sincere advice: P

Is it complicated? It is not difficult to master.

User interface --Web

Business appearance --businessFacade

Business rules --BusinessRules

Data Access - DataAccess

This is, a strict, clear and easy-to-maintain web application. We use a user login process as an example to explore its data flow.

Web / Secure / Logon.aspx accepts user login form submission, triggered the logon.logonbutton_click event (204 lines in web / secure / logon.aspx.cs)

WEB / Secure / Logon.aspx.cs 243 lines:

CustData = (New Customersystem ()). getcustomerbyemail (LogoneMailTextBox.text, LogonpasswordTextBox.text);

BusinessFacade (Business / Facade / Customersystem.cs) implements "User Account Access Interface" logic

Where businessfacade.getcustomerbyemail () (45 lines in Business / Facade / Customersystem.cs) Defines the "Read User Information by Email" interface

Business / Facade / Customersystem.cs 58 lines:

Using (DataAccess.customers CustomersDataAccess = New DataAccess.customers ())

{

DataSet = CustomersDataAccess.loadCustomerbyemail (EmailAddress);

}

DataAccess (DataAccess / Customers.cs) implements "User Account Data Access" logic where Customers.LoadCustomerbyemail () (217 lines in DataAccess / Customers.cs) defines "Read User Information via Email" interface - access SQL Server stored procedure "getcustomerbyemail"

227 lines in DataAccess / Customers.cs:

DScommand.selectCommand = getloadCommand ();

DataAccess.customers.getLoadCommand () Initialize the storage procedure and parameters and returns its interface (112 lines in DataAccess / Customers.cs)

119 lines in DataAccess / Customers.cs:

LoadCommand = New SqlCommand ("getCustomerbyemail", New SqlConnection (DuwamishConfiguration.connections);

Initialize the storage process. Its database connection is obtained by the CONNECTIONSTRING attribute in Common.duwamishConfiguration.

CommON DuwamishConfiguration.cs Defines the access interface of the application configuration information (by the properties of the Access class)

Where duwamishConfiguration.Connetionstring property provides "Database Connection String Access" interface

151 lines in Common / DuwamishConfiguration.cs:

Public Static String Connectionstring

{

get

{

Return dbconnectionstring;

}

}

107 lines in CommON / DuwamiSHConfiguration.cs "Database Connection String" by default value:

Dbconnectionstring = dataaccess_connectionstring_default;

The 107 lines in CommON / DuwamiSHConfiguration.cs are set by the "Database Connection String" in the "Application Profile":

Dbconnectionstring = ApplicationConfiguration.readsetting (Settings, DataAccess_Connectionstring, DataAccess_connectionstring_default);

The ApplicaitionConfiguration class in SystemFramework defines the configuration read and write interface (SystemFramework / ApplicationConfiguration.cs)

Where ApplicationConfiguration.Readsetting defines the "Read Configuration" interface

190 lines in SystemFramework / ApplicationConfiguration.cs:

Public Static String Readsetting (NameValueCollection Settings, String Key, String DefaultValue)

{

Try

{

Object setting = settings [key];

Return (Setting == NULL)? DefaultValue: (String) Setting;

}

Catch

{

Return DefaultValue;

}

}

转载请注明原文地址:https://www.9cbs.com/read-106446.html

New Post(0)