Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2004, 12:19 PM
Authorized User
 
Join Date: Mar 2004
Location: , , United Kingdom.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataRow Vs Custom Class

Hi all,

I know this is gonna sound like a wierd question but i need some help, howerever this is not a direct question about the book.

In the User Data Class, when we want to get the details of a user we use a DataRow and pass that back, howver in the next chapter(news) we also have the facility (and it is used with the loadfromID() method of that module) to pass the values across. My question is when do we make that descision, as i am trying to expand on the book and i have an employers class, and now i dont know if i should return a dataRow or a custom Class????

Can anyone help me and explain?

Rob

  #2 (permalink)  
Old April 2nd, 2004, 01:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I thought the approach you had, returning an object with parameters to represent the employer. You can do both, in the function that returns the object, pass the datarow in the new constructor (or through a function) which is used to provide the values for the parameters, then return the object to the caller. However, I have a large enough app where this became a headache, so I stuck with the ADO.NET objects.

Hope this helps,

Brian Mains
  #3 (permalink)  
Old April 3rd, 2004, 06:01 AM
Authorized User
 
Join Date: Nov 2003
Location: Caterham, Surrey, United Kingdom.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This issue is a perennial point of discussion for .net developers. If you want a fully OO solution then custom objects will give you that, at the cost of having to write much more code - although tools like CodeSmith make this task much easier. The point about DataSets, DataTables and DataRows is that they come with a lot of intrinsic functionality that in many cases is sufficient (even excessive) for many simpler applications.

There's no 'correct' answer to this - unless you have strict views on OO architecture. I've found that in most cases, like News, you need a business News class, and it usually helps if this exposes public instance properties. These can be loaded from a DataReader, or provided by parameters to the constructor. But the class can also provide static methods returning either a DataReader or a DataRow or DataSet to satisfay common requirements like filling grids or listboxes...



brian
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom style class oldSkool BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 January 9th, 2007 03:39 AM
Ajax and Custom Class ~Bean~ ASP.NET 1.0 and 1.1 Professional 0 April 6th, 2006 12:33 PM
creating an event for a custom class? lkubler BOOK: Beginning Access 2003 VBA 3 September 20th, 2005 03:47 PM
DataRow Or Class Object? RM82 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 June 11th, 2004 09:12 PM



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


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