A DotNet (.NET) Data Access Layer in C#
2/5/2004
For historical reasons, I'm leaving this page here, but PeteDALLib has
been moved to SourceForge
(click here to download the software)
and has been renamed DotNet DAL Lib. The move to sourceforge is largely because
I need to use the library in another sourceforge project called
World-Wide Knowledge Base.
Because of this, you can expect that the library will be updated quite a bit
over the coming months as the requirements for wwkb will go far beyond what
the original library was able to do. I also hope to get regular contributors from
SourceForge to help in furthering the library. In the meantime, here's
the original page, minus the link to the code:
This is an alpha version of a Data Access Layer (DAL) library written in
C# for .NET (but like any .NET Library, it's usable by any .NET language) I'm building,
and I thought I'd put it out there and maybe someone would have some feedback
about it.
The library was written with two things in mind: Ease of use and simplicity.
Most of the data access libraries I've seen for .NET seem to lack one or both
of these two things. By ease of use, I mean from tables to code in a matter of
seconds. By simplicity, I mean I can load data, insert data, update data and
delete data in very few lines of code (2, really. 1 to instantiate the
reader or writer and 1 to load, save, or delete). It's really that simple.
There is documentation for most of the code, but as the code isn't quite
done, neither is the documentation. My hope is to have it all in release form
in a matter of a couple of weeks. As I'm already using it in some projects,
it is very functional.
The DALWriter class is really what needs some work (the collection saver
is very unoptimized, and the other saver needs some cleaning up). But
really, I'm quite pleased with the way it's come out so far. I also want
to add support for stored procedures, which should be fairly trivial.
The library is compatible with the OleDb or Sql Data components, and if
you'd like to support others, the classes for the Sql and OleDb specific stuff
are quite simple, so you'd simply need to copy one of them and make appropriate
changes.
I do not intend to add a great deal of functionality to this beyond what's
in there. The idea is for a simple DAL library that doesn't "do everything."
It's meant to do 95%-99% of the data access in your program, and if every once
in a while, it doesn't meet your needs, then you have to write a tiny bit of code.
With the help of CodeSmith,
there's no reason you can't create components specific to your database within
minutes, and be ready to go. Again, it doesn't do everything, and some database
models might be too complex for it, but if you follow basic normalization
procedures, there's no reason it shouldn't work.
If you run into problems, please let me know. If you have ideas that don't
add a lot of complexity, but do add flexibility and/or functionality, let me know.
I'm always open to ideas.