Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 9th, 2008, 04:53 PM
Friend of Wrox
Points: 630, Level: 9
Points: 630, Level: 9 Points: 630, Level: 9 Points: 630, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Austin, TX, USA.
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default Do we need Business Logic Layer.vb files?

On Microsoft Data Access Tutorials, instead of just creating datasets in App_Code, Business Logic Layer (BLL) classes were created as a proxy for the presentation layer to access the Data Access Layer data.

Is BLL a new, advanced class to program the Web database applications? If we can use datasets directly, why we need the BLL.vb files?

TIA,
Jeffrey
__________________
C. Jeffrey Wang
  #2 (permalink)  
Old January 9th, 2008, 05:10 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Jeffrey,

An additional business layer gives you flexibility and functionality in a lot of different areas, including centralized business logic and the possibility to switch databases.

You may want to take a look here: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416 for some ideas about business layers in ASP.NET applications.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #3 (permalink)  
Old January 9th, 2008, 05:30 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Also, by decoupling your business logic from your user interface, you promote reuse of your business logic code for other programs. It may gain you much with simple "one-off" database web apps, but it's a vital piece of application architecture design for larger business apps.

Yet another reason for these "separation of concerns" is to provide the capability to use unit testing frameworks. These frameworks are very difficult if not impossible to use when your business logic lives in web project classes or the pages themselves. By building atomic business logic units you can automate tests against them using a unit testing framework.

-Peter
  #4 (permalink)  
Old January 9th, 2008, 07:23 PM
Friend of Wrox
Points: 630, Level: 9
Points: 630, Level: 9 Points: 630, Level: 9 Points: 630, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Austin, TX, USA.
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default

I believe you both are right.

First thing first. On P. 4,the Tutorial-02 showed some Methods after creating a BLL.vb file. My question is how to 'add' these methods to the BLL classes. By typing the vb codes? Moving the methods created in Datasets.xsd files to here? How?

Any examples showing how to add the Methods to a BLL class?

Thanks.
Jeffrey
  #5 (permalink)  
Old January 9th, 2008, 10:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Imar,

Definitely excited to have stumbled across the QuikDoc you referenced today. Looking forward to playing with it for hours!

I downloaded and ran the C# version, and just noticed one odd behavior. Try this:

1. Run the app.
2. Click the button fields on gvContactPersons in exactly this sequence:

Imar Spaanjaars - Email
Some other Dude - Addresses
Some other Dude - Email

Some other dude has got your e-mail address!

Or try any version of that sequence:

Imar Spaanjaars - Phonenumbers
Some other Dude - Email
Some other Dude - Phonenumbers

Imar Spaanjaars - Addresses
Some other Dude - Email
Some other Dude - Addresses

Some other Dude's info isn't displayed. Imar Spaanjaars info appears instead. When I click the Some other dude ButtonField the second time in any of these sequences, WhateverManager.GetList isn't firing. A round-trip to the database isn't happening, so a new Some other Dude business object isn't getting returned. It looks like the View is still bound to the old Imar Spaanjaars object, or something.

Are you seeing what I'm seeing??

Thanks for putting this together. Have to poke around on your site more often!!

Best,

Bob

  #6 (permalink)  
Old January 10th, 2008, 01:54 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't know what code you are referring to exactly, but yes, usually you "add" methods into a class by typing in code, copying and pasting it from somewhere else, use built in code generation tools (the Class Designer / Create Method Stub etc) or use external tools like Code Rush.

I don't know what's relevant / referred to in your situation...

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #7 (permalink)  
Old January 10th, 2008, 04:55 PM
Friend of Wrox
Points: 630, Level: 9
Points: 630, Level: 9 Points: 630, Level: 9 Points: 630, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Austin, TX, USA.
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks.

As I expect, we need to type in codes, use Class Designer, or other tools to add the methods to a BLL.vb file.

Jeffrey
  #8 (permalink)  
Old January 10th, 2008, 05:10 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Bob,

Thanks for catching that. Seems like a bug to me. The fix is easy though; just DataBind the relevant GridView controls whenever you choose a new option:
Code:
switch (e.CommandName.ToLower())
{
  case "addresses":
    gvContactPersons.SelectedIndex = Convert.ToInt32(e.CommandArgument);
    MultiView1.ActiveViewIndex = 0;
    gvAddresses.DataBind();
    break;
  case "emailaddresses":
    gvContactPersons.SelectedIndex = Convert.ToInt32(e.CommandArgument);
    MultiView1.ActiveViewIndex = 1;
    gvEmailAddresses.DataBind();
    break;
  case "phonenumbers":
    gvContactPersons.SelectedIndex = Convert.ToInt32(e.CommandArgument);
    MultiView1.ActiveViewIndex = 2;
    gvPhoneNumbers.DataBind();
    break;
  case "edit":
    ....
}
Will try to update the article ASAP....

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #9 (permalink)  
Old January 10th, 2008, 10:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Thanks Imar. Works great.

Bob

  #10 (permalink)  
Old January 11th, 2008, 12:58 PM
Friend of Wrox
Points: 630, Level: 9
Points: 630, Level: 9 Points: 630, Level: 9 Points: 630, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Austin, TX, USA.
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default

Just finished reading Part I and get ready for the Part 2.
While trying to recreate the database in SQL Server 2000, I was not sure which download link is for the T-SQL scripts. quickdoc=?

TIA,
Jeffrey

Quote:
quote:Originally posted by Imar
 Hi Jeffrey,

An additional business layer gives you flexibility and functionality in a lot of different areas, including centralized business logic and the possibility to switch databases.

You may want to take a look here: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416 for some ideas about business layers in ASP.NET applications.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Transparent Business Layer pinch BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 February 17th, 2008 02:19 AM
Handle Transactions from Business Logic Layer sonishpaul ASP.NET 2.0 Professional 1 December 3rd, 2007 05:52 AM
Question about Business Layer hasanali00 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 March 21st, 2005 06:49 PM
Errors in a business layer bmains ASP.NET 1.x and 2.0 Application Design 1 February 11th, 2005 02:27 PM
Mixing Data access logic and business logic polrtex BOOK: Professional Jakarta Struts 0 December 15th, 2003 07:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.