Skip to content Skip to sidebar Skip to footer

Guidelines For Build A .net Web Application That Can Use "plug-in" Data Access Layers

I'm building an application which will initially use SQLServer 2008 as the DBMS. How should I structure my application so that at a later stage I can use a different DBMS, e.g. Ora

Solution 1:

What you should look at doing is either use an ORM tool that abstracts the database for you (nHibernate), or define a set of interfaces that represent your DAL and then use an IoC implementation (Ninject, Castle, etc) to swap out the underlying implementation at will, so long as it implements the interface.

However, designing an interface that is future-proof (ie, can cope with subtle quirks of working with other databases) is not simple, so you could end up needing to make changes anyway.

I'd do one of two things, in this order:

  1. Review if you really need to swap out databases.
  2. Go down the ORM tool route as a lot of leg-work is done for you.

A good example of abstracting a database, not necessarily the DAL per-se is the Enterprise Library Data Access Application Block from Microsoft.

Post a Comment for "Guidelines For Build A .net Web Application That Can Use "plug-in" Data Access Layers"