Question on two 'flavors' of data access layers

K

kbutterly

Good morning,

I have seen two different types of data access layers and I am
wondering which, if either, is considered best practice, or if one is
better suited to certain situations than the other.

The first type is the DAL described in this MSDN article as well as in
the tutorial on the www.asp.net website:
http://msdn2.microsoft.com/en-us/library/
aa581778.aspx#aspnet_tutorial01_dataaccesslayer_vb_topic3

This first type uses typed datasets to build a DAL and then creates a
Business Logic Layer made up of classes that access the table adapters
from the DAL. This type has the names of the stored procedures in the
DAL.

The second type uses a class to wrap all the database connection code
and that class is the data access layer. Then the BLL calls this
class to handle database operations. This type has the BLL pass the
names of the stored procedure to the DAL as a parameter.

I see these as two fundamentally different ways to handle three-tier
architechture. Is one considered more robust? I can see that the
second type would have a very reusable DAL if it was designed
properly.

Any comments, references, links, war stories, would be greatly
appreciated.

Thanks,
Kathryn
 
G

Guest

Kathryn,
There really isn't any "Best practices" rule on this subject. Whatever
"floats your boat".
Personally, I prefer the latter one, typed datasets not ever having gotten
me particularly excited.

Peter
 
S

sloan

///
The second type uses a class to wrap all the database connection code
and that class is the data access layer. Then the BLL calls this
class to handle database operations. This type has the BLL pass the
names of the stored procedure to the DAL as a parameter.

////

This is when people use some helper class....as their DAL. this is
deficient in my opinion.
The helper is NOT the DAL. it ~~helps the DAL. That's where some make the
mistake.




Read my article:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/blog/

Where I outline some issues that you typically find. Alot of people throw
around the terms "layer" "data access layer" "tiers" etc, but its not always
well understood.

The goal of your DAL is to isolate you from the RDBMS you are using.

In my world, the dal returns
DataSets
IDataReaders
void/nothing
a scalar value
and nothing else.

.................
We'll call this option #3 since its not really what others are doing.

I'm not a table adapter person.

..

Also, read my post
http://groups.google.com/groups/search?q="class+EmployeeDataViaAccess+:+IDatabaseObject"
go to the first hit, and find my entry:

Date: Mon, 20 Nov 2006 23:03:29 -0500
Local: Mon, Nov 20 2006 11:03 pm


that's if you think you're writing a DAL, which sometimes will hit one db,
and sometimes hit another one.

Here is another good example at:
http://groups.google.com/group/micr...de+for+the+two+'concrete'+data+access+layers"
(first hit)



And, in my blog I show this
And a reference to read from start to finish, aka, very informative for a
bird's eye view:
*
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/BOAGag.asp

I read that thing about every 4 months.
 
K

kbutterly

Sloan,

Thanks so much for all the info; I have already printed out the msdn
article to read tonight!

Thanks again,
Kathryn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top