D
DS
Is there a way to automatically close the data reader connection? I'm using
the MS Data Access Application block to substantially {entirely} separate
the data access layer (DAL) from the business layer (BL) and this is great
with DataSets since they can be closed off in the DAL, but it doesn't seem
possible with the DataReader since it would need to be .close() in the BL
once I'm done with it.
I've read on the web that there is a bit of a debate about using something
like this:
using (DataReader dr = ExecuteReader(...))
{
return dr;
}
-- supposedly this automatically calls the dispose and closes the connection
once you're done with it in the BL, but some say its no good.
How should I go about making use of it, or should I just stick to DataSets?
Thanks in advance.
the MS Data Access Application block to substantially {entirely} separate
the data access layer (DAL) from the business layer (BL) and this is great
with DataSets since they can be closed off in the DAL, but it doesn't seem
possible with the DataReader since it would need to be .close() in the BL
once I'm done with it.
I've read on the web that there is a bit of a debate about using something
like this:
using (DataReader dr = ExecuteReader(...))
{
return dr;
}
-- supposedly this automatically calls the dispose and closes the connection
once you're done with it in the BL, but some say its no good.
How should I go about making use of it, or should I just stick to DataSets?
Thanks in advance.