Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > VB.NET General Discussion

VB.NET General Discussion VB.NET general discussion area

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-04-2009, 12:42 AM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Feb 2009
Age: 23
Posts: 45
Reputation: 15
witecloner is on a distinguished programming path ahead
Question How to build the correct way of n-tier apps without service and remoting?

Sorry if my thread is place in incorrect forum.

Hai All ...

Could anybody help me? i'm praticing how to build the n'tier application. I have read some book tell about this, like "Building Client/Server Applications With VB.NET" by Jeff Levinson, beth massi video tutorial "building simple n-tier applications", and other else.

In my practice, i create 3 projects to handle each layer progress. That are DAL (Data Access Layer), BLL(Business Logic Layer) and UIL (User Interface Layer).

My problem is i don't want to use web service like beth massi do, and i don't want to use remote object like Jeff L do. So i decide to create it by my rules. Here above something that i do.

In DAL Section, I put all datasource like Beth Massi do over here. I also create a manager class like massi do to handle datasource over here. Also in this class, i create the UML structure of this datasource.

Code:
'SatuanManager.vb
Option Strict On
Option Explicit On

Imports TradingStudio.BLL.Structures
Imports TradingStudio.BLL.Interfaces
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient

Public Class SatuanManager

    'Inherits MarshalByRefObject

    Implements ISatuan

    Public Sub Delete_Record(ByVal intUID As Integer) Implements BLL.Interfaces.ISatuan.Delete_Record

    End Sub

    Public Function Loading_Data() As BLL.DataSet_Satuan Implements BLL.Interfaces.ISatuan.Loading_Data
        Dim ta As New DAL.DataSet_SatuanTableAdapters.UnitTableAdapter
        Dim Satuan As New BLL.DataSet_Satuan

        ta.FillByFlag(Satuan.Unit)

        Return Satuan
    End Function

    Public Function Loading_Record(ByVal intUID As Integer) As BLL.Structures.Structure_Satuan Implements BLL.Interfaces.ISatuan.Loading_Record

    End Function

    Public Sub Save_Record(ByVal StrucSatuan As BLL.Structures.Structure_Satuan, ByRef intUID As Integer) Implements BLL.Interfaces.ISatuan.Save_Record

    End Sub

#Region "Private Attributes"
    Private paUnitUID As Integer
    Private paUnitID As String
    Private paUnitName As String
    Private paUnitModerator As String
    Private paUnitFlag As Boolean
    Private paUnitModified As Date
#End Region

    Public ReadOnly Property UnitUID() As Integer
        Get
            Return paUnitUID
        End Get
    End Property

    Public ReadOnly Property UnitFlag() As Boolean
        Get
            Return paUnitFlag
        End Get
    End Property

    Public ReadOnly Property UnitModified() As Date
        Get
            Return paUnitModified
        End Get
    End Property

    Public Property UnitID() As String
        Get
            Return paUnitID
        End Get
        Set(ByVal value As String)
            paUnitID = value
        End Set
    End Property

    Public Property UnitName() As String
        Get
            Return paUnitName
        End Get
        Set(ByVal value As String)
            paUnitName = value
        End Set
    End Property

    Public Property UnitModerator() As String
        Get
            Return paUnitModerator
        End Get
        Set(ByVal value As String)
            paUnitModerator = value
        End Set
    End Property

End Class
In BLL Section, the dataset which i put in DAL Section auto generate over this section. I also create two class again in this section. There are Interfaces class and Structures class.

Code:
'Interfaces.vb
Option Strict On
Option Explicit On

Imports TradingStudio.BLL

Namespace Interfaces

    Public Interface ISatuan
        Function Loading_Data() As DataSet_Satuan
        Function Loading_Record(ByVal intUID As Integer) As Structures.Structure_Satuan
        Sub Save_Record(ByVal StrucSatuan As Structures.Structure_Satuan, ByRef intUID As Integer)
        Sub Delete_Record(ByVal intUID As Integer)
    End Interface

End Namespace
Code:
'Structures.vb
Option Strict On
Option Explicit On

Namespace Structures

    <Serializable()> Public Structure Structure_Satuan
        'Public Structure Structure_Satuan
        Public UnitUID As Integer
        Public UnitID As String
        Public UnitName As String
        Public Moderator As String 'Sama Dengan Operator
        Public Flag As Boolean
        Public Modified As Date 'bisa juga dengan menggunakan byte()
    End Structure

End Namespace
In BLL Section, I build user form over here. Over this user form i create a datagridview to show the dataset rows.

Code:
'UI_Form.vb
Imports TradingStudio.BLL
Imports TradingStudio.DAL

Public Class Satuan_Main

    Private Sub Satuan_Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim DataSatuan As New DAL.SatuanManager

        Me.DataGridView1.DataSource = DataSatuan.Loading_Data.Unit

        With Me.DataGridView1
            .Columns("UnitUID").Visible = False
            .Columns("Flag").Visible = False
            .Columns("Modified").Visible = False
            .ReadOnly = True
        End With

    End Sub
End Class
And Here above my complete source :
myN-Tier

Am i build a correct way of the n-tier applications? where should i place user interface presentation? where should i place that uml object?

thank's
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 10:28 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.