The Business Logic Layer (BLL)To build the Business Logic Layer we will:
And that's it! This is the step that is usually the hardest for beginners to understand but is really not that complicated. However, ASP.NET 2.0 does provide a major reduction of code over the ASP.NET 1.1 version. |
|
Alter the "GuestBookInfo.vb" fileIn Visual Studio, select VIEW from the toolbar and "Solution Explorer" |
|
In the Solution Explorer, expand the "GuestBook" directory under the "App_code" folder and double-click on the "GuestBookInfo.vb" file. | |
Replace every single line of code in the file with this code: | |
System Imports System.Configuration Imports System.Data Namespace YourCompany.Modules.GuestBook Public Class GuestBookInfo Private _ModuleId As IntegerPrivate _ID As Integer Private _Name As String Private _Email As String Private _Message As String Private _DateEntered As DateTime ' initialization Public Sub New() MyBase.New() End Sub ' <summary> ' Gets and sets the Module Id ' </summary> Public Property ModuleId() As Integer Get Return _ModuleId End Get Set(ByVal value As Integer) _ModuleId = value End Set End Property
|
|
Alter the "GuestBookController.vb" fileIn Visual Studio, select VIEW from the toolbar and "Solution Explorer" |
|
In the Solution Explorer, expand the "GuestBook" directory under the "App_code" folder and double-click on the "GuestBookController.vb" file. | |
Replace every single line of code in the file with this code: | |
System Imports System.Collections.Generic Imports System.Configuration Imports System.ComponentModel Imports System.Data Imports System.Xml Imports System.Web Imports DotNetNuke Imports DotNetNuke.Common Imports DotNetNuke.Common.Utilities Imports DotNetNuke.Entities.Modules Imports DotNetNuke.Services.Search Namespace YourCompany.Modules.GuestBook Public
Class
GuestBookController <DataObjectMethod(DataObjectMethodType.Delete)> _ DataProvider.Instance.YourCompany_GuestBook_Delete(objTest.ID) End Sub <DataObjectMethod(DataObjectMethodType.Select)> _ Return CBO.FillCollection(Of GuestBookInfo)(DataProvider.Instance().YourCompany_GuestBook_GetAll(ModuleId)) End Function <DataObjectMethod(DataObjectMethodType.Update)> _ DataProvider.Instance.YourCompany_GuestBook_Update(objTest.ID, objTest.Name, objTest.Email, objTest.Message, objTest.DateEntered) End Sub End Class End Namespace |
|
Review
We are done with the Business Logic Layer. |
|
What did we just do?The "GuestBookInfo.vb" was created. This is just a simple class file. It will hold the data |
|
The "GuestBookController.vb" was created. This class has 4
methods:
|
|
A Lot Of Stuff Was DeletedYou may notice that a lot of code was deleted out of the "GuestBookController.vb" file. Some of this was the optional interfaces that handle exporting data and searching. These are interfaces that you will want to read about and implement in your modules. However, they are not required and they are left out for simplicity. A lot of code was eliminated by using code that is exclusive to ASP.NET 2.0 and incompatible with ASP.NET 1.1. ASP.NET 2.0 really saves you a lot of work and requires less code. |
|
BACK
|
Next: The Presentation Layer (UI) |
DotNetNuke® is a registered trademark of Perpetual Motion Interactive Systems Inc.