Custom "tb_access positioning" subclass
In many applications, a "feature value" is often used to obtain a (or a group) record meeting the constraints from a given data object (front-end dataset or physical table in the background, in addition, to implement certain subsequent functions, "Tb _ location access" is to implement this series of continuous actions with the most concise operations and standardized encapsulation design.
4.3.1.1 proposition proposal
Database access is an essential implementation process in the implementation process. Because physical tables may be a large set of records, it is not easy to find a desired target record. Generally, some pre-known "feature values" are used to form an appropriate logical expression, and then the logical conditions are used to record the search. In the project design process, similar data has too many requirements. Therefore, it is necessary to encapsulate a dedicated control class to support this common operation mode.
Because the target object may be different, the access method is different, the speed of attention is different, and the processing method after data is obtained is different, first, we need to analyze the forms and objectives of requirements in application scenarios.
1) feature values and search methods:
1. The meaning of the data used will change randomly, such as the help code, number, and name;
2. The search method varies, such as left matching, exact matching, and fuzzy search.
2) the requirements for different focuses are as follows:
1. Focus on the speed of reflection. For example, the cashier system in the supermarket is concerned about the speed;
2. Focus on the search range. When the feature value is ambiguous, you will be more interested in the recognition range and matching method.
3) The possibility of search results:
1. The corresponding record does not exist: it may lead to repeated operations or different consequences such as changing the operation logic;
2. Unique record: the operation is achieved;
3. More than one record set: Generally, the operation for selecting a record may be selected or selected.
4) achieve the purpose of data orientation:
1. Locate the pointer to a record in the current dataset using the feature value and use it as an operation object;
2. Refresh one or more controls on the screen through the accessed data to provide the reference environment for the operator;
3. Synchronously refresh datasets with other possible associations;
4. Rewrite another dataset or insert it to another dataset.
5) different types of data source objects:
1. localized dataset datetabel;
2. Grid Data container datagridview.
Each problem raised here generally does not exist independently, so smaller granularity levels cannot be encapsulated, because these requirements often come in a related and continuous combination form. Because there are many variables involved in the proposition, the solution to each problem requires the cooperation of "Custom Attributes" to meet the adaptability requirements.
Tip: we can break down the above problem into two different layers. One Layer achieves the goal by "locating access, the subclass "positioning Insert" derived from it will provide subsequent data processing processes on this basis.
4.3.1.2 Design Concept
This concept has a long path and is difficult to understand. We can give several practical propositions in the application to illustrate the purpose of this design.
1) when maintaining or viewing a large data set, we hope to quickly locate the pointer through simple feature values;
2) When creating a exchange ticket, you want to quickly check the exchange legal person and determine the organization of the other party. At the same time, you need to use the legal person data to refresh the related controls on the screen.
The design topic of this control consists of four conceptual stages:
1) receive input values: analyze the feature words of the input values and determine relevant parameters and implementation methods for data access;
2) Data Access: access to the reference physical table is implemented based on the input feature value and the method determined;
3) Processing return value: Determine the processing method based on the number of returned records, and finally obtain one of the records;
4) operation purpose: Use the obtained data for record locating or data refresh.
Because the control inherits the "ITF _ binding" interface, it can also be bound to fields and support data entry functions.