Open.Database.Extensions
Extensions on the standard ADO.NET types that make everyday database work short to write and robust by default. Version 11 is in preview.
You write the SQL. This library writes the other twenty lines.
Post[] posts = await connectionFactory
.Command("select * from posts where author = @author order by id")
.AddParam("author", 42)
.Map<Post>()
.ToArrayAsync();
The idea
- A foundation of best-practice extensions. Most of the library is a provider-agnostic collection of extensions on
IDbConnection,IDbCommand,IDataReaderand friends. They apply the usual best practices (open late, close early, dispose what you create, honor cancellation) so common database work is almost effortless. See The foundation. - Expressive commands on top. Build a command from a connection factory or a connection, add parameters, and call a terminal. See Expressive commands.
- Row mapping on top of that.
Map<T>()reads rows into your classes. See Mapping rows to objects. - All of it rests on performance. The goal is to keep a connection open for as short a time as possible and to allocate as little as possible. See Performance for what is measured and what is not.
Start here
| I want to... | Read |
|---|---|
| Install it and run a first query | Getting started |
| Stream rows into a channel or a dataflow block | Channels and Dataflow |
| See how it differs from Dapper | Coming from Dapper |
| See what changed in 11 | What's new in 11 |
| Look up a type or a method | API reference |
Every code sample in this guide is compiled by the build and run against SQLite before the site is published.