ResourceDataInc/Simpler.Data — pull request #7 by gregoryjscott (2014-05-28 19:29:09+00:00)
Title: Simplify the `Db` API

The current `Db` API has 4 methods for running SQL and returning results.

* `Stuff[] stuff = Db.Get(connection, sql)`
* `Results multipleThings = Db.Get(connection, sql)`
* `int rowsAffected = Db.NonQuery(connection, sql)`
* `object result = Db.Scalar(connection, sql)`

I can't remember the last time I used one of the last two methods. The first one is just a convenience wrapper for the second as you can see here https://github.com/ResourceDataInc/Simpler.Data/blob/master/api/Simpler.Data/Db.cs#L36-L40. I'm not sure that `Db.Get()` is any better than `Db.Get().Read`. Therefore, it seems possible that the API could be trimmed down to just one method that runs SQL and returns results.

While working on the documentation, I ended up creating the headers **Connection to a Database** and **Running SQL** to describe the functionality. That led me to think that renaming `Db.Get` to `Db.Run` (which takes a `string sql` parameter) might be more appropriate. I've often thought that `Get` is somewhat misleading since your SQL can do whatever you wants before returning a result. Therefore, `Db.Get` was renamed to `Db.Run`.

In summary, the `Db` class would end up with a total of just two methods, `Db.Connect()` which is an optional method for creating an open connection, and `Db.Run()` for running SQL.

These changes make this library unique compared to the other options for database access. I believe it becomes the easiest to use ORM available. I was struggling for a good reason to keep this library around with so many other options available. In my mind, these changes make it worthwhile.