In this series, we will learn the entire process of general business systems, covering all aspects from the database to the Silverlight page. The example follows my consistent style and does not use any third-party framework. But for the sake of simplicity, multiple types of database support are not considered here (in fact, multiple database support is very simple when a stored procedure can be used, just encapsulate a database access layer ), at the same time, to reduce the texture pressure, we assume that you have no problems with the creation of basic Silverlight programs. The general framework of the entire program is as follows:
1) Database: SQL Server is used in the example.
2) application service layer: divided into 4.5 layers, where the entity layer needs to be shared by most layers, so we strive to be simple and clean (except for the necessary attributes, do not give the entity any method ), the other four layers are:
A) database access layer: This layer is designed to simplify database access interfaces at the data access layer, and to support different types of databases;
B) data access layer: This layer provides access to various business data, including query, modification, deletion, and addition. The purpose of this layer is to make the business logic layer irrelevant to the database for data access (whether it is a database or not ), the service layer can build blocks in the Process of business logic processing, which facilitates the processing and reuse of complex business logic.
C) business logic layer: responsible for processing the business logic. At the same time, the RIA service layer data needs to be normalized and encapsulated here. If the business logic involves multiple data at the same time, you can also create different data access instances here.
D) WCF Ria service layer: it is mainly responsible for providing services to the Silverlight client and checking the security of client and server calls. Note that this layer does not carry out any business logic except security checks, instead, it directly calls the corresponding methods of the business logic.
The advantages of the above layer are that the business logic can be provided to the RIA service layer. In fact, it is applicable to ASPnet, WebService, winform, and so on, and business logic can be reused to the maximum extent.
3) Silverlight client: consists of four layers: entity and Service proxy layer, model layer, view model layer, and view layer.
A) entity and Service proxy layer: This layer includes automatically generated entities and service proxies, which are mainly responsible for remote service calls with the server.
B) model layer (m): Processes data caches and calls services at the service proxy layer. The purpose of adding this layer is to make the VM layer less concerned about whether the data comes from local or network services. After all, Silverlight is a rich client Technical System;
C) view model layer (VM): Organizes model data of a view and provides certain view control functions.
D) view layer (V): interacts with the customer and reports the interaction to the VM layer in a timely manner.