Re: closing DataReader in another layer
From: Nick Malik (nickmalik_at_hotmail.nospam.com)
Date: 11/26/04
- Next message: Jim Lawton: "Re: slow access to MySql Database"
- Previous message: avnrao: "Re: Icon in contextmenu.."
- In reply to: DS: "Re: closing DataReader in another layer"
- Next in thread: DS: "Re: closing DataReader in another layer"
- Reply: DS: "Re: closing DataReader in another layer"
- Reply: Anders Borum: "Re: closing DataReader in another layer"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 26 Nov 2004 07:55:50 GMT
> >
> > However, you might consider DataSets for a different reason: They
actually
> > can go across physical layers, not just logical ones.
> >
>
> I'd like to not even have to call the .Close on the reader in the business
> tier as it is easy to forget to do, especially down the road. With a
dataset
> its not a big deal since I can close the connection in the DAL before the
> dataset even gets returned and never have to worry about it in the buiness
> layer.
Hi Dan,
If you have truly seperated the data layer from the business layer, then you
really should use the dataset. A lot of folks pan the dataset because the
data is read into an object that gets passed around and it takes time to
load up the object. The same folks then encapsulate their data into an
object and, guess what, they pass it around, rarely adding much more
functionality to it than the dataset already has.
One thing that I have done, in my code, is to create an object that contains
a dataset. I pass my object into my DAL, which fills the contained dataset
with data. I then pass my object around, which as some additional
functionality for validating and enforcing business rules. When it comes
time to update the database, I pass my object back to the DAL, which then
uses the internal dataset to update the database. That way, I get the
functionality of the Dataset, plus the business rules enforcement of my
application, with a minimum of code to debug.
(I don't believe in re-inventing the wheel).
Hope this helps,
--- Nick
- Next message: Jim Lawton: "Re: slow access to MySql Database"
- Previous message: avnrao: "Re: Icon in contextmenu.."
- In reply to: DS: "Re: closing DataReader in another layer"
- Next in thread: DS: "Re: closing DataReader in another layer"
- Reply: DS: "Re: closing DataReader in another layer"
- Reply: Anders Borum: "Re: closing DataReader in another layer"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|