When you generate your data access layer, the program will create multiple classes, one for each table in your database. Each class contains methods for inserting, updating and deleting as well as properties that map to each column in the table the class represents. Each C# class represents a row in the related table and the program also produces custom collections that map to multiple records in the table.
For an easy example, let’s consider you have an existing database
with one table called TCustomer. After running the utility and
selecting your existing database, the program will output a class
called TCustomer.cs and TCustomers.cs. The first class (TCustomer.cs)
will contain properties that directly map to each column in the
table so there might be a property called LastName, FirstName, and
SocialSecurityNumber. This class will also have the following
methods created that allow you manipulate data in that table:
1) Insert – inserts all of the properties into a new record in the
database
2) Update – updates the current properties to an existing record in
the database
3) Delete – removes a given record from the database
4) SelectOne – given a primary key, will retrieve one record from
the database and returns an instance of the TCustomer class.
5) SelectAll – returns all the records in TCustomer in the form of
an instance of the custom collection (TCustomers)
6) SelectByField – gets all records in TCustomer where the given
field equals the given value and returns a collection of TCustomers
There are also some additional methods that are created when logical
keys have been defined on a set of fields in a table (e.g.
SelectOneByTCustomer_LogicalKeyName) and there are other methods
created that handle returning child records from other tables by
virtue of foreign keys (e.g. SelectOneWithTInvoices).
This utility will save you many hours of coding basic crud
functionality and currently produces C# classes and stored
procedures that support SQL Server 2005 and SQL Server 2008.




