What is it Table Data Gateway is an object that plays a data table that handles all pairs of access and operations. Many developers are not familiar with SQL, even those familiar, it is not seen to write the program. Both CRUD operations of the operation access data table are placed in the Table Data Gateway object, and the developer can call the interface to interact with the data sheet.
How IT Works Table Data Gateway is often stateless, just responsible for data from the database. It is more technically how to handle multiple items returned from the request because many of our programming languages can only return a value. One way is to use Map, MAP is a simple data structure, which can map the return item of the database to Table Data Gateway, but this method must copy the data from the recordset to Map, and lose the compilation time inspection, The interface is not clear. Another method is to use Data Transfer Object. In a lot of DOTNET, Table Data Gateway can be used well with Table Module, etc. in many ways such as the Record Set. Table Data Gateway can also be used with Domain Model by returning Domain Object, but this is not good, two modes are closely linked together, difficult to separate. A general Table Data Gateway's instance corresponds to a table in the database, and for some simple cases, you can even use an instance to operate all the tables. Accessing the database via Data View rather than Data Table can also reduce the coupling between the same database structure. However, when using Data View, you often don't be available.
When to use it Table Data Gateway is almost the most simple database interface, which is well packaged for the actual process of operating database data. It can work with Table Module mode, in fact, you can't think of other database interfaces that Table Module will use. It is rarely used in Domain Model mode because Data Mapper provides a better data isolation function. Like Row Data Gateway, Table Data Gateway can also cooperate with Transaction Scripts and take care of how you want to handle multi-line data. Many people tend to use Data Transfer Object, but unless the same Data Transfer object is used by all, otherwise it is nothing benefit.