Project DescriptionA 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, some development is done. As development proceeds, the documentation tab will contain information about how it can be used. Until that time, you are welcome to peruse the source code to see how development is coming.
PostgreSQL, MySQL, SQL Server, SQLite, and ODBC SupportDatabase 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.
Unit TestableDatabase 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 RepositoryThe 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.