I just updated the module developers guide to provide some detail on the DAL+. Currently the most detailed description is available in my latest tutorial. I am working on updating the entire module developers guide and plan to have that complete by October.
The following is a section that appears after an explanation of the current "traditional DAL".
An alternative to the data access layer (the DAL) described above is the DAL+. The DAL+ is only available for DotNetNuke 4.3 or higher (or DotNetNuke 3.3 or higher). The DAL+ is an alternative method of communicating with the database. This method will still allow you to communicate with an alternate database.
However, unlike the traditional DAL that was previously described, the DAL+ is not 100% "portable" to other data sources. It's is best used for modules that will not be distributed to other DotNetNuke sites that run on a database other than the database you develop the module on. For those situations it is best to use the traditional DAL described above.
The purpose of the DAL+ is to simplify module development by a reduction in code and complexity. The DAL+ allows you to make “calls” to the database directly from the “controller” class. Meaning, you do not have to code a separate data provider. Using the DAL+ you would not need to code the SQLDataProvider class described above.
The DAL+ achieves this by providing the following generic methods:
- ExecuteNonQuery - Used to execute a stored procedure or sql statement that will not return a value.
- ExecuteReader - Used to execute a stored procedure or sql statement that will return multiple records.
- ExecuteScalar - Used to execute a stored procedure or sql statement that will return a single value.
Below is an explanation of the format used to implement the DAL+. The ExecuteReader method is used in the example to “call” a stored procedure named "ThingsForSale_SelectAll:
This will allow a module developer to use code such as:
Private Function GetItems(ByVal ModuleId As Integer) As ArrayList |
Return CBO.FillCollection(DataProvider.Instance().ExecuteReader("GetItems",ModuleId), GetType(ItemInfo)) |
Private Function |
The generic methods will exist in all the concrete data providers that support DotNetNuke 4.3 or higher.