Overview

The Table Data Gateway template generates C# and VB.NET multi-tier WinForm and WebForm applications that utilize the Table Data Gateway architecture to access databases. The Table Data Gateway (J2EE developers may know it as DAO) is the most popular pattern for database-driven .NET applications. It provides efficient isolation of SQL code and logic, reduces development time and maintenance cost. It also significantly reduces efforts needed to port applications from one DB engine to another. The pattern is well described in the book "Patterns of Enterprise Application Architecture" by Martin Fowler. Highly recommended reading.

The generated DB-tier code supports both DataSets and Data Transfer Objects. This approach allows you to choose the most efficient data access type in different situations. While DataSets are easier to bind to UI controls, Data Transfer Objects are faster, easier to integrate with non-.Net systems, and require less memory.

Stored Procedures

Using this template you can control whether the generated code will be using stored procedures or dynamic SQL to access the database. The template creates all necessary stored procedures for the generated DB-tier code, and wraps existing stored procedures allowing you to call them as regular .NET methods.

Data Provider Independent Code

The Table Data Gateway template generates database-engine-specific and provider-independent code. As a result you can easily switch among various .NET data providers choosing the one that better serves your needs. See Changing .NET data provider for more details.

Customization

If the database schema is changed, you can regenerate code without loosing your customizations. To support this feature the template generates two types of classes Base and User.

The Base classes (<DatabaseCodeName>_Base, <TableCodeName>Row_Base, <TableCodeName>Collection_Base, StoredProcedures_Base) are regenerated every time RapTier generates code, and they should not be changed manually.

To implement additional functionality or override the existing methods, utilize the User classes (<DatabaseCodeName>, <TableCodeName>Row, <TableCodeName>Collection, StoredProcedures). RapTier generates these classes only once and never overwrites them.