Tycho.Sql - API Documentation

Tycho.Sql is a wrapper library for ADO.NET which simplifies your direct Sql calls. It has a number of advantages over native ADO.NET:

  • Presents an API which speaks in terms of .NET native data types by providing automatic conversion of Sql data types where possible, and transparent access to ADO.NET accessor objects when things get more complex.
  • Configurable error detection with the ability to automatically re-try failed sql commands.
  • Pipeline fully plumbed with async.
  • Ability to easily digest multiple output data sets with predefined DTOs or anonymous types.
  • Easy access to the use of table valued parameters in your Sql commands.
  • Lightweight, adding negligible processing time to your application.

Download

Download Current Version

Tycho.Sql is available for free on the public Nuget servers at Nuget.org.

Source code is available for free on BitBucket.

Getting Started

Calls into Tycho.Sql start with the creation of a Sql object. There are a number of overloads available for this constructor if you want to configure a default timeout or exception handler, but for now lets keep things simple:

Sql sql = new Sql(ConnectionStringOrName);

This object is friendly with dependency injection frameworks. If you need to connect to multiple Sql servers or databases, simply create multiple Sql objects to support your needs.

Once you have an intsance, use it to begin a fluent Sql command as either a Statement or Procedure:

sql.Procedure("NameOfProcedure")
   .Execute();
...
sql.Statement("SELECT [ColName] FROM [TableName]")
   .Execute();

So, you might notice that the SELECT statement in the example above doesn't appear to do anything with the data or make it accessible to your application. Details about this will be covered in other sections. What is important for now is understanding that both .Procedure() and .Statement() methods lead you into a common set of fluent configuration and execution operations.

Next

Sql Object