The Table Data Gateway provides efficient isolation of the SQL and low-level ADO.NET code from the business logic, encapsulating all database related code in the gateway classes. RapTier generates two gateway classes for every table and view in the database.
The <TableCodeName>Collection_Base abstract class is regenerated every time RapTier generates code. It contains select, insert, update, delete, and record mapping methods for a single table or view.
The <TableCodeName>Collection class is generated only if it does not exist already. It extends the <TableCodeName>Collection_Base class and can be used to add custom functionality to the table gateway. For example, you may want to add a method that returns all users who live in a certain city.
C#:
public User[] GetCityUsers(string
city)
{
return GetAsArray("City='" +
city + "'", null);
}
VB.NET:
Public Function GetCityUsers(city
As String) As User()
Return GetAsArray("City='" +
city + "'", Nothing)
End Function
To call a table data gateway method perform the following steps:
For more information about calling the standard gateway methods, see the following topics: