Generated Data Layer

Listed below are quick descriptions of the Data Layer class files AspxFormsGen 4.5 generates that makes up the Data Tier. In a 3-tier infrastructure, data layer code is called by the middle layer code. It contains calls to the database (stored procedures/ad-hoc or dynamic SQL).

One of each of the following objects listed below is generated per table in your database.

Generated Class (.cs/.vb) Quick Description (App_Code Folder)
1. Data Layer Base Class A class file containing methods communicating with the database. The methods encapsulates calls to stored procedures or ad-hoc/dynamic SQL. Used as a base class.
2. Data Layer Class A class file derived from the data layer base class. Additional methods may be added here.

Accessing Code From the Middle Tier

To make it really simple, the Data Layer method signatures are very similar to the Middle Layer method signatures, we simply add a string constant "DataLayer" to the middle layer method name to call data layer objects. For example if the middle tier object name is Categories, then the respective data tier object name is CategoriesDataLayer. To call a data layer method you simply add a dot and then the method name; e.g. CategoriesLayer.TheMethodName();

Note: These are generated code, you don't have to write anything to call them. Data Layer code is called/encapsulated by the Middle Layer methods. Code below are just examples on how you would call these methods.

Select Everything

// we generally don't assign to a variable
var allCategories = CategoriesLayer.SelectAll();

// instead, we simply return the collection to the calling middle tier method
return CategoriesLayer.SelectAll();
' we generally don't assign to a variable
Dim allCategories = CategoriesLayer.SelectAll()

' instead, we simply return the collection to the calling middle tier method
return CategoriesLayer.SelectAll()