About/Contact

Steve Trefethen

Steve Trefethen is a Director of Engineering at Reply. Contact me

View my LinkedIn profile


Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
$720 in referrals so far!


Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.



Data Access Layers (DAL) on the .NET framework

November 21 2006 4:33PM

A Data Access Layer, commonly referred to as a "DAL" is code that provides the ability to view, edit, update and otherwise manipulate persistent data within an application. In many cases, a DAL can be generated from a database schema and alleviates developers from the task of writing highly repetitive code. All of the DAL's I've looked at have benefits and detractors so the task of actually selecting the perfect implementation isn't straight forward and will depend on the application requirements as well as the developers ability work with the given DAL implementation.

There are lot's of DAL implementations available like:  

There are many others but the above list represents ones I've either experimented with or actually used with the one exception being CLSA.NET which I've seen mentioned in numerous places and thus why included it.

A few months ago SPOIL implementation in particular caught my eye and seems quite interesting. In fact, I did some digging on this one and found that a BorCon speaker Steve Scott presented the same idea at BorCon 2003 and even before that Atif Aziz had developed DBMethods though there is no mention of it in the MSDN article (referenced above) but I did find an interesting comment from Atif. For a website I've been working on over the past few years I chose to use CodeSmith 2.6 which is a freeware code generator specifically for it's "collection of database templates" which are included in the download. These templates provide several pieces of the DAL puzzle including:

  • Stored Procedure generation for all CRUD operations
  • Command wrappers for the above stored procs
  • Typed datasets
  • Business Objects
  • Typed collections

Of course, lots of things have changed since I made my choice, CodeSmith is up to version 4.0 and now sold commercially and AFAICT garnered quite a following not to mention .NET 2.0 was new at the time and there wasn't a whole lot of support for it. Additionally, the templates were subsequently updated to utilize C# 2.0 features like generics. CodeSmith is an easy to use code generation tool that has an interesting template technology that borrows techniques from ASP.NET. I'll admit it took me awhile to convince myself that I needed to go this route at all but eventually I was satisfied with the decision. I'd have probably gone in a different direction today though I don't really feel locked into the decision I made since the code is fairly boiler plate and it wouldn't be that difficult to switch to another DAL.

A couple of months ago I spent quite a bit of time looking into Adapdev and it's supporting tools Codus, a code generator and Zanebug a unit testing tool. It's really a nice combination and allows you to quickly generate a DAL and immediately test it allowing you to quickly locate problems. The developer Sean McCormack has been very responsive to bugs and even quickly turned around a fix for a significant problem I had run into. Unfortunately, he has recently blogged about a slowdown in the development though I think it's still well worth a look.

I don't want to ramble on too long so I'll wrap it up by saying that I've had some good success finding very useful DAL implementations though I have yet to find one that has really addressed all of my needs. If you've been doing similar work I'd be interested to know what's worked for you.

Update: Paul Hectors made the comment that CSLA.NET is a Business Object framework and not a DAL implementation. He's right. Here is a link that explains what CSLA.NET is from the author himself. Thanks for the correction Paul.

[UPDATED: April 25, 2008] Related post:

FacebookDel.icio.usDigg It!

Tags: ,

Comments (12) -

11/21/2006 7:55:05 PM #

Hi Steve,

I would just like to make you aware that I would not class CSLA.net as  a DAL. It is a mobile/business objects framework and declares abstract  methods for persistence where it is up to the user to use the DAL of preference.

Best regards,

Paul

Paul Hectors

11/21/2006 8:13:47 PM #

Hi Paul,
  Good point. I had debated a different title for this entry which included mentioning Business Objects as they are frequently coupled with a DAL. Dan Miser originally mentioned CLSA.NET to me a long time ago and including it here was probably not the best idea.

Thanks again for pointing this out and I'll update this entry to clarify things.

-Steve

Steve Trefethen

11/21/2006 9:41:39 PM #

Hey Steve!  Thanks for the kind words regarding Codus and my other Adapdev projects.  FYI, I plan on kicking things back into high speed come January...I even have some new stuff that I'll be releasing.  So, just bear with me as I catch my breath a little. Smile  Development will definitely continue.

Have a great day!

Sean

Sean McCormack

11/21/2006 9:48:16 PM #

Hi Sean,
  Great news! I've still got my eye on Adapdev and Codus though I myself haven't had the time necessary to really get moving on it. I'm hoping either over the holidays or after the first of the year I'll get back into it again.

-Steve

Steve Trefethen

11/21/2006 10:21:09 PM #

I heard of an excellent product that was created by a company formerly named Borland, now CodeGear. <shaking his head>

I love your support for Open Source and similar products, but I wonder why you did not mention ECO as it is much more powerful than most of the products you mention here.

Holger Flick

11/22/2006 12:01:39 AM #

Yes, Steve good article, but where is ECO, it has many features that the product in this articles don't have, I think the ECO is to main reason to keep with CodeGear, becouse I don´t  see any product like ECO
to visual studio

kind regards
Frank

Frank

11/22/2006 5:20:06 AM #

Hi Holger & Frank,
  The requirements of a project I was working on for a client included availability of source code and use of stored procedures which precluded the use of ECO. The project was unrelated to my work at Borland however I feel the information is valuble and thus worth sharing.

-Steve
  

Steve Trefethen

11/22/2006 9:43:40 AM #

Steve,

This is what we are using (C#):

http://www.llblgen.com

p.s.
Not free but worth the money.

~Zarko Gajic

Zarko Gajic

11/22/2006 4:52:50 PM #

Hi Zarko,
  Thanks for the link, I've heard of LLBLGen but have never really looked at it, I will now though. Smile

-Steve

Steve Trefethen

11/24/2006 5:59:56 PM #

Good news about Adapadev. You know where Sean lives, don't you, Steve? Smile

I'm starting a new project on a handheld, and will keep you in the loop on any good data libraries I come across.

Dan

Dan Miser

5/19/2007 11:05:40 AM #

Hello,

Ive created a dal generator for C# myself, cause i was missing functions at all the other ones.

Its free to download at http://www.dalgen.net

DoDo

5/21/2007 9:46:52 PM #

DoDo,
  Thanks for letting me know. And to potentially save other some typing here is a real link:

http://www.dalgen.net">http://www.dalgen.net

Steve Trefethen

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading