Project Description
A database abstraction service for .NET that segregates data access calls from actual data implementation. This puts SQL code in one place (query libraries), makes it easy to change data stores (ex. SQLite to SQL Server, MySQL to PostgreSQL, etc.), and removes this noise from the actual implementation (in many cases, reducing it to one line). It is not an object-relational mapping tool, like NHibernate or EF Code First; nor is it a magic wire-up, like LINQ-to-SQL. Rather, the purpose of this project is to allow you to write the SQL exactly the way you need it, without having to embed that SQL within many files, while utilizing the mature and lightweight ADO.NET interfaces.

This is a place to share something that I'm writing anyway, in hopes that it may be helpful to others. At this time, most development is done. The Documentation tab contains information about setting it up, how to implement it to persist and retrieve data, and how to use that in an application. Since it is open-source, you are also welcome to peruse the Source Code tab to review API documentation or the Example project that uses the library.

PostgreSQL, MySQL, SQL Server, SQLite, and ODBC Support (and now with Async!)

Database Abstraction supports PostgreSQL, MySQL, SQL Server, and SQLite databases, as well as ODBC database connections. As long as you define your variables using the IDatabaseService interface, and instantiate it with the database-specific service, switching data stores should be easy. There is even a utility method that will attempt to derive the concrete class based on the conection string; if you utilize this, you may be able to switch data stores with no code changes at all.

If you are using .NET framework version 4.5, you can also use IDatabaseServiceAsync to free up your other threads while making these calls. See the Documentation tab for more information on asynchronous database access.

Unit Testable

Database Abstraction also provides a Mock Database Service instance, which records data access calls. You can even construct it with StubResultSets, and these sets of data will be returned on subsequent calls.

DLLs in Source Code Repository

The output DLL is in the source code repository, and it will be current with each commit to the repository. If you're interested in trying it in its current state, you'll have to download the tip, but you won't have to build it - it's in DatabaseAbstraction/bin/Release. For PostgreSQL, you'll need Npgsql to make it work; for MySQL, you'll need the MySQL Connector/.NET; for SQLite, you'll need System.Data.SQLite. The versions of these DLLs against which the Database Abstraction DLL was built are also in the repository under DatabaseAbstraction/bin. The lastest version of Npgsql can be obtained from the Npgsql Project, and the latest version of MySQL Connector/.NET can be obtained from MySQL; the version of System.Data.SQLite is the most current one, as it is no longer in active development in that state.

Last edited Apr 2, 2013 at 1:56 PM by danielsummers, version 13