Design data layer components and inter-layer data circulation (1)

zhaozj2021-02-16  48

SUMMARY: How to make a maximum extent of data in Microsoft .NET applications and how to implement valid data circulation in distributed applications.

content

Introduction

Mapping relationship data and business entities

Implement data access logic components

Implement business entity

Transaction

check

Abnormal management

Authorization and security

Configure

appendix

Partner

Introduction When designing a distributed app, you should decide how to access and represent business data related to your application. This article provides a help you choose the most appropriate wizard: display data, continuous data in each layer. Circulation data.

Figure 1 depicts a usual hierarchy of a distributed application. This article separates business data and business processing, and the business processing layer will be discussed in the need to clarify. Similarly, the business representation is also discussed only, for example, Microsoft ASP.NET displays business data with a web page. Figure 1 refers to two new terms: data access logic components and data entity components. These terms will be explained in this article.

Figure 1 Access and representing data in distributed applications

Most applications use the relational database to save data. However, there are also other choices for saving data. This article focuses on how to use the relational database in .NET applications and will not specifically discuss other data storage forms such as flat files or non-relational databases. This article has a clear difference in the representation layer and the data itself. Separation of continuous logic from data is as follows: • Separation data continuous components can isolate applications for dependencies of the database, such as the name, connection information, and field names of the data source.

· Many applications today use low-coupling, messaging technology, such as XML Web services and Microsoft messages. These applications use business documents to communicate more than using circular objects.

Note: For XML Web services, please refer to the relevant documentation for the message queue. http://msdn.microsoft.com/msdnmag/issues/02/03/webmethods/webmethods.asp XML Web Services

Http://msdn.microsoft.com/architecture/application/default.aspx?pull=/library/en-us/msmq/msmq_about_overview_1p9z.asp Message Queue

In order to achieve the purpose of continuous logic and data itself, this article handles two unreasonable components.

· Business entity components. Data is used to represent business entities in real life, such as products or orders. There are various ways to apply this to represent business entities - such as XML or DataSet or object-based customized class - dependent on physical and logical application design restrictions. Design selection will be studied in this article.

l Data Access Logic Components. Data Acquisition logic components acquire data from the data and save entity data to the database. Data access logic components also contain any business logic used to obtain data association operations.

Data Acquisition Logic Components A Data Acquisition Logic Component provides a method of using a database to perform the following tasks:

· Create a record in the database

· Read records in the database and return to the business entity to the caller

· Update record in the database, modify business entities via caller

· Remove records in data

These methods are often referred to as "crud" methods, "crUD" is the first alphanumeric thread of each task.

Data Acquisition logic components also have a method of implementing business logic depending on the database. For example, a data access logic component may have a method to find the most sales of products in a directory.

Typically, a data access logic component access a single database and encapsulates a data operation of a single table or multiple table in the database. For example, you can define a data access logic component to handle the client table and address table in the database, another data access logic component to process the order table and order details. The mapping design decisions in the database logical component to the database table will be discussed later. Business entity

Each data access logic component handles a specific business entity. For example, customer data access logic components handle customer business entities. There are many way to express business entities, mainly depends on the following factors:

· Do you need to use binding entity data to control Microsoft form form or ASP.NET page?

· Do you need to perform save or query operations on business entity data?

· Is your application handle a business entity or handle business entity collection?

· Are you configuring your app in the local or remote?

· Is the business entity used by the XML Web service?

· How important is the non-functional demand, such as performance, scalability, maintenance, and the convenience of the program?

This article will list the advantages and disadvantages of the following options: • XML you use an XML string or XML DOM (Document Object Model) object to represent business entity data. XML is an open flexible data representation that can be used to integrate a variety of different applications.

• DataSet DataSet is a cache of a memory, taken from a relational database or an XML document. A data access logic component can use a DataSet to represent a business entity data from a database, you can use DataSet in your application. For Dataset, please see "ADO.NET introduction" http: // msdn. Microsoft.com/architecture/Application/default.aspx?pull=/library/en-us/dnbda/html/daag.asp

· Typed DataSet is a Typed DataSet is an inherited from the ADO.NET DataSet class and provides strong Typed methods, events, and properties to repay tables and fields in DataSet.

· Business Entity Components This is a customized class that uses each business entity type. Define fields to represent data of business entities, define properties to display data to client applications. Using the definition of the field class definition method to encapsulate simple business logic. This option does not implement a CRUD method. The customer application communicates with the CRUD operation directly through the data access logic component.

· Business entity components containing crud behavior. Define the customer entity class as previously described, you can implement Crud method by calling the method under the data access logic component

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

New Post(0)