PEAA notes 3: Table module

xiaoxiao2021-03-06  49

What is it Table module is a separate instance of the business logic for processing a data sheet or data view. In general, Domain Model is based on object-oriented mode based on object / identity, that is, such as an instance of an employee class, corresponding to a particular employee, so we can operate, obtain employee information, etc. The poor difference in these modes is that it is difficult to form a good interface to form a large number of work to handle data between the two performances of the business layer and the database. Table module, otherwise, it creates an instance of a class for each table in the database to operate the data in the table.

How IT Works Table Module Mode allows us to package data and their behavior, and maintain a good connection with the database. It is often used as a table-oriented background data structure, and the characteristic data is generally the RECORDSET return value called by the SQL statement. Table Module can make the class's individual instances, or a set of static functions of the class. The way of using examples gives us a bigger advantage, which is convenient to initialize through an existing Recordset, and it is also easy to expand through inheritance. Table module mode can be implemented by plant mode, and the other method is to introduce Table Data Gateway classes and mechanisms through Table Data Gateway. It is in good way to use only one Table Module, for different data. Source, use different Table Data Gateway, it is possible to use Table Module to use the Table Data Gateway to put the data into the RECORDSET, then create a Table Module with its parameters, handle business logic through Table Module, and modify the results Remove the database. In the middle of the process, Recordset data has been in memory without having to return to the database. Of course, Table Module is not limited to table, table / view / SQL query results, etc. can be applied.

When To Use it Table Module is based on the watch-oriented data, and it must put the data structure throughout the code. In the face of a complex business logic, it does not provide enough examples - TO-instance capabilities, there is still no shortcomings in the processing polymorphism, then we should still use Domain Model, Domain Model Active Record can also handle data. Table Module is more common in COM applications because Microsoft's ADO library provides a good mechanism that uses RecordSet to process data from the database.

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

New Post(0)