Quantcast

Maximum PC

It is currently Wed Jul 30, 2014 3:47 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Can someone give me an idea for a OOP project
PostPosted: Mon May 16, 2011 4:04 am 
SON OF A GUN
SON OF A GUN
User avatar

Joined: Mon Nov 01, 2004 5:41 am
Posts: 11605
Reason for your DataReader? Same concept. The idea is to make each "layer" not care about the other. Keep ALL data access out of the business layer. So when you chance databases, you don't have to modify those libraries.

Why wouldn't you use a DataTable? The DataTable isn't specific to any database or data store for that matter. It is a System.Data object, not a System.Data.SqlClient or whatever. What if you decided you wanted to save your data in an XML file instead of to a database? If you are using DataSets with datatables that represent the actual tables in your application, then you can use DataSet.WriteXml() and DataSet.ReadXml() to save and load from XML files instead of databases.

This change ONLY happens in your data access (which, mind you, in your sample application there is ZERO method for deleting or updating data, only retrieving it. Very basic and almost never happens where you would select data and then not update it in some way). The actual business object doesn't care!


Top
  Profile  
 
 Post subject: Re: Can someone give me an idea for a OOP project
PostPosted: Wed May 18, 2011 4:52 pm 
Little Foot
Little Foot

Joined: Sat Feb 11, 2006 11:04 am
Posts: 174
quick question. The data access layer shouldnt inherit from the business object right?


Top
  Profile  
 
 Post subject: Re: Can someone give me an idea for a OOP project
PostPosted: Wed May 18, 2011 7:23 pm 
SON OF A GUN
SON OF A GUN
User avatar

Joined: Mon Nov 01, 2004 5:41 am
Posts: 11605
No, there shouldn't be any inheritance going on. The Business layer has a reference to the Data access layer.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group