I'm currently working on a large windows forms app for a client. We use a Data Abstraction Layer (DAL) to access all our data from our database. We want to be able to encapsulate all the T-SQL stuff in these set of classes (library) so if we decide to change engines, the code should be minimally impacted. One of the main tasks performed by our DB classes is to import a large amount of data (5-50MB) from a device that uses a DCOM interface. We do all this in a transaction so we can rollback if the connection fails. Since the whole set of INSERTS are contained in a single transaction we use WITH (NOLOCK) in all our SELECT statements. This allows us to read all the committed rows in the tables we are working on. Further, we chose to use a schema independent architecture a few years back. By this I mean that we use methods like GetStudy(int StudyID) in a class called DataDB instead of a method called SelectByID(int id) in a class called TblStudiesBase. The problem is that the classes have grown to many thousands of line and is becoming unwieldy and difficult to remember the names of methods to perform certain queries. For example did we call a method AddStudy() or InsertNewStudy(). We have considered just standardizing the naming convention but I'm looking at other architectures we can use. We've been looking at
Microsoft Patterns and Practices for some guidance, but have found very little in the way of improving what we have done (from a code management standpoint). We have also looked a DAL tools like
Codus and
LLBLGen. Both of these do a nice job creating custom objects based on the DB schema, but we're not sure if this is appropriate for our architecture. If we were building a business app where we only made occasional schema changes, I think a DAL tool would work well. However, we are constantly adding new tables, views and relationships to support new devices. For this we designed a custom schema management engine in the application that allows us to embedded and run T-SQL files based on the schema version. This part seems to work fairly well. BTW, this application is a windows forms app that currently uses MSDE as it's DB engine. The mdf and ldf are distributed with the install and the update simple runs the T-SQL scripts to update existing DB's thus preserving data. So my question is this: How would you handle this? What would your architecture look like? What tools would you use?
87cae5f3-037d-41ae-ae9a-eb400d001691|0|.0