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.

Like this Article? Subscribe to get every article sent to your email.

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 […]
  • 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.  […]
  • 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 […]
  • What’s In My Blogging Toolbox?What’s In My Blogging Toolbox? So as I thought this week about what I might write, I decided to review the various tools that I use to get stuff done.  I started this post with the stuff I use to create the blog […]
  • 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 […]

About Dave Bush

Dave Bush is a Full Stack ASP.NET developer. His commitment to quality through test driven development, vast knowledge of C#, HTML, CSS and JavaScript as well as his ability to mentor younger programmers and his passion for Agile/Scrum as defined by the Agile Manifesto and the Scrum Alliance will certainly be an asset to your organization.

One Pingback/Trackback