DayPath Journal

Songhay Data Access Ready for!

Yoda Mug

I actually need this for my current work:

  • I removed the Songhay.DataAccess.Runner namespace from the Songhay.DataAccess project.
  • I’ve renamed the old Songhay.DataAccess.Runner project to Songhay.DataAccess.Runner-Console (this might be a new convention going forward).
  • I’ve generated a new Songhay.DataAccess.Runner project with the removed assets from the Songhay.DataAccess project

Now that the DAR stuff is cleanly separated from the System.Data.Common stuff, my generic data access routines that date back to .NET 2.0 is ready for the public.

Songhay Data Access

Songhay Data Access

Songhay Data Access is a set of static helper classes defining routines around System.Data.Common. As of this writing Songhay Data Access has been used with SQLite, MySQL and SQL Server, but, in theory, this set of libraries will work with any database that has an ADO.NET provider written for it.

Here are some of the highlights:

  • Gets a Common.DbConnection object from a provider name and connection string (in CommonDbms).
  • Converts a generic Dictionary into an array of IDataParameter (in CommonParameter).
  • Returns a string or an object with an IDbConnection and a SQL statement (in CommonScalar).
  • Returns an instance of IDataReader with an IDbConnection and a SQL statement (in CommonReader).
  • Returns an XPathDocument with an IDbConnection and a SQL statement (in CommonReader).
  • Full support for parsing Nullable generics with overloads for custom default values (in FrameworkTypeUtility).

Most “normal” .NET developers, starting out with .NET 1.x or 2.x, live almost exclusively in the world of System.Data.SqlClient to meet data-access needs. I was drawn to System.Data.Common from the very beginning because Microsoft’s work in this namespace represents ‘the sequel’ to ODBC—of the olden days of COM when Don Box was but a young Jedi. Writing helpers for System.Data.Common seems like, um, “common” sense to me, while investing heavily in System.Data.SqlClient is a bold declaration that all databases on your watch will be SQL Server for ever more.

I was very pleased to find out that the Entity Framework is based on System.Data.Common. Songhay Data Access is my tiny alternative to the Entity Framework, when I need to get as close to the DBMS as .NET will allow.