Technical thinking
Figure 2 shows the impact of the technical implementation for data access logic components and business entities. This article gives analysis and provides reference recommendations for each technical thinking.
Relationship data to a map of business entities
The database typically includes multiple tables and establishes a relationship through the primary keys. When defining a business entity in your .NET application is, you must first decide how to map these tables and business entities.
Considering the hypothesis retailer database, Figure 3
The following is an example in an example database.
TYPE OF RELATIONSHIP
EXAMPLE
Description
One-to-Many
Customer: AddressCustomer: Order
.
MANY-TO-MANY
ORDER: PRODUCT
An ORDER CAN COMPRESE MANY PRODUCTS; Each Product Is Represented by a Separate Row in The OrderDetails Table. LikeWise, a Product Can Be Featured In Many ORDERS.
When you define a business entity to simulate information in a database, consider how to use this information in your app. Confirm that the key features in your application to the core business entity are confirmed, and then some separate business entities correspond to each table.
In the assumed retailer application, the typical operation is as follows:
· A (or updated) user information, including his / her address
· Get the list of customer orders
· Get a single order for a specific order
· Next new order
· Acquisition (or update) information of one or more products
In order to complete the needs of these applications, there are three logical business entities that require application processing: customers, orders, products. Every business entity is a separation data access logic component, defined as follows
· Customer Data Acquisition Logic Components This class will have the ability to get and modify the client table and address table data.
· Order Data Acquisition Logic Components This class will have the function of obtaining and modifying the order table and order details
Product Data Acquisition Logic Components This class will have functions for obtaining and modifying product table data. Figure 4 depicts the relationship between data access logic components and corresponding database tables for implementing data access logic components, seeing the following: Implementing data Acquisition of logical component relationship data to business entity mapping
Relationship data to the mapping of business entities, consider the following suggestions
· Time to analyze the logical business entity of the application and model, not a separate business entity to define each table. How to implement modeling work, use UML. UML is a formal design symbol based on object application modeling, which is used to capture objects to express confidence and automatic processing, human factors, and relationships. More information: http://msdn.microsoft.com/architecture/application/default.aspx? Pull = / library / en-us / vsent7 / html / vxorimodelingyourapplicationData.asp for your application and data modeling
• Do not define separate business stones to represent many-to-many tables in the database; these relationships are displayed by implementing data access logic components. For example, the order details in the previous example are not mapped into multiple business entities. Conversely, the order data access logic component encapsulates the order details table to obtain multiple pairs of relationships between orders and products. · If your method returns a specific type of business entity, these methods are placed in the data access logic component to express this type. For example, to achieve all orders for a customer, implement this method in the order data access logic component, because your return value is a placement type. Conversely, if all order customers of the specified product should be obtained, this feature should be implemented in the customer data access logic component.
• Data Acquisition Logic components typically access data in a single data source. If you need to aggregate a plurality of data sources, it is recommended to define individual data source data to obtain individual data source data, and then implement integration at higher levels. There are two reasons for this way:
· Transaction Management Concentrates in business processing components, does not require display control of data access logic components. If you need multiple data sources from a data access logic component, you need data access logic components as a basis for transactions, which will introduce additional high-level functions when you read data.
· Integration usually does not need all areas of applications, by separating access data, when needed, you can make specific types as an integrated part.