Jump to content

ASP.NET/Data Access Layer and Business Logic Layer

From Wikibooks, open books for an open world

DAL (Data Access Layer) & BLL (Business Logic Layer)

[edit | edit source]

DataSet

[edit | edit source]

Add New Item: DataSet Open the database viewer, drag and drop database tables into the DataSet viewer.

From the DataSet viewer, you can right click on the table, add new queries and configure them as per standard SQL using the wizard.

BLL (Business Logic Layer)

[edit | edit source]

Add New Item: Class Naming Convention is to suffix the class name with BLL for example 'CustomersBLL'

Imports OrderingSystemDSTableAdapters

<System.ComponentModel.DataObject()> _
Public Class CustomersBLL

    Private _customersAdapater As CustomersTableAdapter = Nothing
    Protected ReadOnly Property CustomersAdapater() As CustomersTableAdapter
        Get
            If _customersAdapater Is Nothing Then
                _customersAdapater = New CustomersTableAdapter()
            End If
            Return _customersAdapater 
        End Get
    End Property

    <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
    Public Function getCustomer() As OrderingSystemDS.CustomersDataTable
        Return CustomersAdapater.GetCustomers()
    End Function

    <System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, False)> _
    Public Function getCustomerByCustomerID(ByVal CustomerID As Integer) As OrderingSystemDS.CustomersDataTable
        Return CustomersAdapater.GetCustomerByCustomerID(CustomerID)
    End Function

End Class