Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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
 
Old December 1st, 2006, 08:15 AM
Registered User
 
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default n-tier with composite objects

After reading the book I decided to use the BLL/DAL architecture in my current project. So far I've gotten the layers written in a similar way to the book (3 files per object: business obj, data obj, and obj provider), but I've run into something that the book doesn't address and I'm having trouble finding info on.

All of the objects in the book are made up of simple typed properties (DateTime, int, string, etc).

In my application (for a school) I've got an object "Student" that among other things contains 3 "Contact" objects. One has the contact info (address,phone,email,etc) for the student, and then a Contact for each parent.

My problem is that I don't know where to put the code in the Student files than manages the Contact objects.

For example if I do:
Student joe = Students.GetStudentByID(15);
joe.Grade = "A";
joe.ContactInfo.phone = "555-5555";
joe.Father.email = "[email protected]";
joe.Update();

Should the Student object update the Contact object in the business layer or in the data layer?
 
Old December 1st, 2006, 08:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

All object updates like this are handled in the business layer first. Then, you have to decide how to persist the OOP class changes in the underlying DB.

Typically the DAL won't have much business object support, but will only be a light layer around SQL and stored procs. The interface between the DAL and the BLL should be simpler and lower-level than the interface between the BLL and UI code.

That's doesn't mean you can't use objects at all between DAL and BLL. But the common usage is to use data container classes, or DataSets, or DataReaders there. An .Update method is OK, but not something more advanced that would involve data manipulation and not merely persistance.

The gray area is always filtering. I prefer to filter using SQL, so this blurs my boundaries :-(

Eric

 
Old December 1st, 2006, 09:29 PM
Registered User
 
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So if I understand right in my example you'd have code like this in the Student BLL class:

class Student : BizObject {

method void Update() {

    this.ContactInfo.Update();
    this.Father.Update();

    this.Update(this.StudentID, this.Grade, this.ContactID, this.FatherID, etc)

}
...}
 
Old December 3rd, 2006, 11:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That would be fine. Then the DAL determines what to do in order to implement the Update method.

Eric






Similar Threads
Thread Thread Starter Forum Replies Last Post
Keep 3 tier schema watxu BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 22nd, 2008 09:35 AM
Difference between 3 tier and N-Tier architecture Manoj Bisht ASP.NET 2.0 Professional 2 May 9th, 2008 08:42 AM
3 Tier example fj8283888 Pro VB.NET 2002/2003 1 August 2nd, 2006 03:44 AM
Three-Tier Deployment shabeeriqbal VB Components 1 February 9th, 2004 11:53 AM





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