Swapping the DAL Abstractly

Last Thursday, we looked at how to replace the TableAdapter with our own TableAdapter as a way or eliminating our dependence on Microsoft SQL.  The problem with this implementation is that every time you want to switch databases, you’ll need to switch what TableAdapter the code is using.

Under normal circumstances, this isn’t an issue.  Most of us pick a database and stick with it.  But, there are times when we’d like to be able to have our product support multiple databases.  Maybe we have a Windows application that will work fine using an Access database for example, but we know that in larger installations they’d be much happier with a SQL implementation.  Or maybe we have customers that have a religious conviction toward a specific implementation of SQL.

Today, I’m going to show you the first step in how to write your code in such a way that the BLL will not need to change every time you switch the DAL.

Related Post

  • Using Reflection to Load a Class in ASP.NETUsing Reflection to Load a Class in ASP.NET Last week, we took a look at creating a DAL that would allow us to swap out database providers without having to rewrite a lot of our code.  The only problem with the code I showed you is that...
  • DataSets, ObjectDataSource and 3-Tier ASP.NETDataSets, ObjectDataSource and 3-Tier ASP.NET As I've mentioned in other post, while I think LINQ has it's uses, I still favor the use of the ObjectDataSource control in conjunction with DataSets and a 3-tiered architecture.  Since any fu...
  • Transaction Tracking Typed Datasets Using SqlTransactionTransaction Tracking Typed Datasets Using SqlTransaction I recently had the need to implement transaction tracking between two separate databases on two separate servers. Unfortunately, I could not be sure that DTC was implemented on either server...
  • Swapping Out the DALSwapping Out the DAL One of the comments that showed up on the blog post about using 3-tiered with DataSets and the ObjectDataSource was, "How do we set this up so that we can swap out the DAL?"  The simple answer...
  • DotNetNuke – Data Access Layer AlternativeDotNetNuke – Data Access Layer Alternative Now that I've explained the standard way of creating a Data Access Layer (DAL) for DotNetNuke, we can address the alternative method of providing this same functionality.You see, the only reason f...