Tag | DAL Posts

Hello everyone This is my first blog entry at this site and first in a couple of years, but I wanted to share something I created with some help. Since generics came out with VS 2005 I wondered if it were possible to create a completely generic data access layer. I also wanted to take advantage of some cool features like custom attributes, enterprise library, and reflection. One that could get and update objects regardless of the type of object being manipulated. With the help of some great authors ...
Well, we've gone and done it. We're no longer using Nettiers. It was good while we were, but the overhead of it eventually became way too much, and since we were doing mostly generic CRUD operations, it no longer made sense. Instead, we're going to write a custom DAL. Here's why: We're working with a LARGE database with some pretty complex data structures, which required quite a bit of customization of Nettiers to make it understand the structures. The knowntypes enumeration in WCF was killing us. ...
I have a couple helper methods that I use all the time during my data access layer. I figured I might as well post them and hopefully help others out. I use the code from this article to pull my field names, that way I can build code like this:public override IEntity PopulateFromOpenIDataReader... dr) { const int ID = 0; const int NAME = 1; const int COMMENT = 2; const int ADDRESS1 = 3; const int ADDRESS2 = 4; Doctor rv = new Doctor(); rv.ID = (int)DataValidation.GetValu... ID, 0); ...