Peab PEAA Note 5: Row Data Gateway

xiaoxiao2021-03-06  42

What is IT Row Data Gateway corresponds to a data record in the data source, one of its instances is a line of data How IT Works Row Data Gateway can work harmonious with Transaction Scripts. Since it corresponds to a line of data, it will face the problem that places where the lookup operation is placed. We can use a static function to find a search operation, but thus throws the feasibility of generating multiple similar lookup operations by polymorphism. Another way is to use the Row Data Gateway, with a Finder object. Row Data Gateway and Active Record are more similar, and the difference is whether there is business logic. Row Data Gateway just contains data access logic, and not to pay attention to the logic of Update data when using Row Data Gateway when using ROW DATA GATEWAY. Row Data Gateway writes code to be cumbersome, but use meatdata mapping a lot, data access code can be automatically generated

When to use IT, using Row Data Gateway when using Transaction Scripts; uses Domain Model without using Row Data Gateway, for simple data mapping, Active Record can be used, complicated can use Data Mapper, the latter pair The database has a good package that makes Domain Object can not know the structure of the database. Gateway is also very efficient when you automatically generate through Metadata when you manually add Data Mapper. Row Data Gateway has played a role of the isolation belt between Domain Object and the database, allowing you to change the database structure on the basis of not change business logic. When using Row Data Gateway in Transaction Scripts, you need to pay attention to if you have some business logics, add business logic to Row Data Gateway, turn the Row Data Gateway to Active Record, this Reducing the repetition code of business logic will be effective

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

New Post(0)