CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2006
    Posts
    141

    3 Tier Architecture in ASP.net 2.0

    Hi,
    i am in the process to come out a 3 tier architecture for ASP.net 2.0
    The Architecture that i want is
    (1).DAL(Data Acess Layer) in App_Code folder
    (2).BLL(Business Logic Layer) in App_Code folder
    (3).Connection to Database in DAL is done through ObjectDataSource instead of TableAdapter, and SqlDataSource.





    I have search in google for few days but still not able to get the sample architecture i want.
    I understand the logic for the three 3tier, but how to do it programmatically is different .Does anyone has any idea on this?

  2. #2
    Join Date
    Jul 2006
    Posts
    141

    Re: 3 Tier Architecture in ASP.net 2.0

    Hi, i have come out the solution by using namespace.

  3. #3
    Join Date
    Jul 2006
    Posts
    141

    Re: 3 Tier Architecture in ASP.net 2.0

    Hi, i have come out a 3 tier architecture for Microsoft VB2005 for ASP.net Framework 2.0.
    I have few question to ask on the 3 tier architecture that i have come out.

    Below is my structure:
    (1). Business Control Layer,Business Logic Layer, Data Access are all in App_Folder



    where Business Control layer is to control user input error, Business Logic layer is to control logic error and Data Access Layer is to interact with SQL Server. This 3 layer communicate to each other using namespace.
    For Example the flow for update, insert delete action to database is:
    Presentation Layer-> BC layer (checking user input error) ->BL Layer (checking business logic error,open connection) ->DA Layer(Perform SQL action).

    The Flow for read is Presentation Layer->BL Layer ->DA Layer.

    My problem is how to control connection for every read that acess more than 1 table and resulted in more than 1 dataset in order to provide data to the presentation layer. The scenario is as below

    Presentation Layer ->BL Layer ->DA Layer.
    function getGUIDisplayData open connection function getGUIDisplayData
    function getGUIDisplayData



    For every function there is only 1 dataset return, if i open connection in BL Layer which mean that function getGUIDisplayData is only able to return 1 dataset for every read.If the presentation layer need more data than 1 data it seem that it is unlogic for keep on open and close connection which actually the connection should be open only once.

    Does anyone has idea on how to control connection in read phase?
    Thanks.

  4. #4
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: 3 Tier Architecture in ASP.net 2.0

    First of all, I'd close the connection to the database after every method. What if your program crahsed? Then you'll have an open connection.

    Second, I recommend to study ADO.NET. You have way more options that just return 1 dataset per method.

  5. #5
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: 3 Tier Architecture in ASP.net 2.0

    I suggest you follow dannystommen's recommendations.

    In C# you can use the 'using' construct when initialising your connection. This will ensure that the connection is closed automatically when it goes out of scope (even if an exception occurs).

    I don't see why you would need more than one data set returned in each request. In a dataset you can have data from different tables. The dataset can be like an in memory representation of a sub-set of the data in the database. You can execute a query that will return data from different tables and fill a dataset with the data.

    I suggest you go to MSDN or Google to find out more about ADO.NET. There are many examples...There is even an ADO.NET forum on this site when you find any problems in your implementation...

  6. #6
    Join Date
    Jul 2006
    Posts
    141

    Re: 3 Tier Architecture in ASP.net 2.0

    Hi dannystommen, nelo,

    I have come out the solution for connection control in reading data from multiple table in database.
    The solution is the DataAdapter will open/close the connection automatically for every read from tables in database. There is no need to code the open /close connection manually in the coding

  7. #7
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    Re: 3 Tier Architecture in ASP.net 2.0

    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured