Duwamish is an enterprise-level Distributed System architecture provided by Microsoft. If an enterprise-level distributed system is developed, it can be imitated. If it is to develop some simple systems, it can be completely simplified.
I have also learned the Duwamish example before, but I have found different experiences and experiences at different times. As Lu Yan said:Through researchDuwamishExample:. NetThe design concept of the application architecture can be learned by the low-handed. NetProgramming skills, is really suitable for all ages.
Therefore, here we will learn and experience the Duwamish example again.
1,Du wamish 7.0The structure is divided into four logical layers (FROM MSDN):
The Web layer provides clients with access to applications. This layer is implemented as a Web project in the Duwamish. sln solution file. The Web layer consists of ASP. NET Web forms and hidden code files. Web forms only use HTML to provide user operations, while code hidden files implement event processing for various controls.
Business appearance layer-Business Facade
The business appearance layer provides an interface for the Web layer to process accounts, category browsing, and book purchases. This layer is implemented as the BusinessFacade project in the Duwamish. sln solution file. The business appearance layer is used as the isolation layer, which isolates the user interface from the implementation of various business functions. Except for low-level systems and support functions, all calls to the database server are performed through this assembly.
Business Rule layer-Business Rules
The business rule layer is implemented as the BusinessRules project in the Duwamish. sln solution file. It contains the implementation of various business rules and logic. Business Rules complete tasks such as verifying customer accounts and book orders.
Data Access layer-Data Access
The data access layer provides data services for the business rule layer. This layer is implemented as the DataAccess project in the Duwamish. sln solution file.
In addition to the above four logic layers, Duwamish 7.0 also contains shared functions encapsulated in the Common project in the Duwamish. sln solution file. The Common layer contains datasets used to transmit information between layers. The Common project also contains the application configuration and tracing classes in the SystemFramework project in the Duwamish. sln solution file.
2. Relationship graph (from msdn) between each logical layer and its call to SequeanceFigure example:
The following is the entire call process for obtaining the Description of Category on the Categories. aspx web page.
(1) instantiate the ProductSystem object
(2) Call the GetCategories () method of ProductSystem
(3) Check the validity of parameters
(4) create a Categories: DataAccess object instance
(5) return the above object
(6) Call the Categories: GetCategories () method of the DataAccess object
(7) create a CategoryData: Common object instance
(8) return the above object
(9) return CategoryData: Common object instance, which contains the required data
(10) return CategoryData: Common object instance to web/Client
(11) Check Data Validity
(12) read and display the result: Description of Category
The SystemFramework project contains configuration parameters required by applications, ApplicationLog log classes, and ApplicationAssert parameter verification classes. The SystemFramework project is referenced by all other projects.
The Common project contains datasets used to transmit information between layers. For example, the CategoryData mentioned above inherits System. data. dataSet is neither the so-called typed DataSet nor the general DataSet. It is simple and practical, and is based on. net Remoting: a distributed system is developed to exchange data between tier and tier. Common projects are also referenced by other projects, except for SystemFramework projects.
All the Classes in the BusinessFacade project inherit the MarshalByRefObject class, which is obviously used to deploy BusinessFacade tier as Remote Objects. However, it is not actually deployed as Remote Objects by default, and the Web layer still calls the local object (《DuwamishDeployment Solution).
When developing enterprise-level Distributed Systems Based on. Net Framework, the above architecture is worth recommending, but it is not flawless. In fact, there are some points worth improving. Obviously, it is impossible for an example to fit all the actual situations. The requirements are too harsh. In fact, the architecture of Fitch and Mather 7.0, another example of Enterprise Samples, is somewhat different from Duwamish.
If you are developing a local system, do not imitate the Duwamish architecture (you can see the process of calling the Description obtained from the Category above, which is too difficult .), For example, the Classes in Business Facade and Business Rules should adopt the fine-grained interface design, and the interaction parameters between layers do not all need to use DataSet. You can use setter/getter as appropriate, this not only improves development efficiency, but also improves performance, maintainability and reusability.