× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



>I would think your data layer would have required the consumer 
>to try and catch exception.  Otherwise, how would the consumer 
>know if customer actually no exist or something is wrong with the
database.

I'm in a C# mindset, I don't need to declare the exceptions that are
thrown. You're correct, I'm assuming the DL would throw an exception if
the customer wasn't found. However, I might not catch it, it all depends
on whether I can do anything about it. Let's say it was a fatal error is
customer 12345 wasn't found, why bother catching the exception and then
throwing another, just let this exception bubble up the tree.

>Also the data layer would probably require a connection 
>to be opened and closed with consumer is done with it. 

I allow the DL to manage the connections. The connection is opened at
the last minute, used and then closed. The consumer doesn't need the
connection object. Besides, if the consumer has the connection object
then the consumer has a pathological coupling to the database. Why
assume that there is a connection involved at all, perhaps the Customer
object doesn't access a database, but instead makes a web-service call.
The consumer shouldn't know or care.

Also, even when I'm not using a true data-layer, I do use an object that
isolates me from the data access plumbing. For example:

SqlDataReader dr = IRBData.ExecuteReader("usp_FormGetPageRelative",
InstanceGUID, DBNull.Value, "Next");

Creates a DataReader (recordset) named dr, by running the
usp_FormGetPageRelative stored proc and passing it 3 parameters. The
IRBData object handles determining the connection string (one way if
used from a web app, a different way if used from a command line app),
creating the connection, setting up the call to the stored proc,
executing it, returning the data reader and closing the connection.

-Walden

------------
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.