Wrox Programmer Forums
|
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 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 April 2nd, 2004, 12:19 PM
Authorized User
 
Join Date: Mar 2004
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

 
Old April 2nd, 2004, 01:41 PM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old April 3rd, 2004, 06:01 AM
Authorized User
 
Join Date: Nov 2003
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





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





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