---
title: "onelite cookbook"
url: https://recursiveai.org/onelite/cookbook/
description: "Answers to common SQLite tasks in C# with OneLite: SQLite without a native library, creating a database and querying it, opening an existing .db file…"
version: "0.2.0-preview.2"
---

# onelite cookbook

Answers to common SQLite tasks in C# with OneLite: SQLite without a native library, creating a database and querying it, opening an existing .db file, ADO.NET with parameters, and transactions. Each recipe is a complete program with the output it really prints on OneLite 0.2.0-preview.2, and each file is checked with the sqlite3 shell 3.53.4 and PRAGMA integrity_check.

## Recipes

- [SQLite in C# without native dependencies](https://recursiveai.org/onelite/cookbook/sqlite-csharp-without-native-dependencies/index.md): Use a SQLite database in C# with no native library: install OneLite from NuGet, create a table, insert and query, then publish and see that no e_sqlite3 .so or .dll ships, even with NativeAOT. Checked with the sqlite3 shell.
- [Create a SQLite database, insert and query in C#](https://recursiveai.org/onelite/cookbook/create-sqlite-database-csharp/index.md): Create a SQLite database file in C#, create a table from a class, insert rows and query them with bound parameters, using OneLite’s happy-path API (no native library). Real output, checked with the sqlite3 shell and PRAGMA integrity_check.
- [Open an existing SQLite .db file in C#](https://recursiveai.org/onelite/cookbook/open-existing-sqlite-database-csharp/index.md): Open an existing SQLite .db file in C# with OneLite and query it: a database made by the sqlite3 shell, switched to WAL mode, checked with OneLite’s own PRAGMA integrity_check, then written and read back in sqlite3.
- [Use SQLite with ADO.NET in C#: DbConnection, DbCommand and parameters](https://recursiveai.org/onelite/cookbook/sqlite-ado-net-csharp/index.md): Use a SQLite database through ADO.NET in C#: DbConnection, DbCommand, named parameters, DbDataReader and ExecuteScalar with OneLite’s RecursiveAI.OneLite.Data provider, async, no native library. Real output, checked with the sqlite3 shell.
- [Transactions in C# with SQLite: commit and rollback](https://recursiveai.org/onelite/cookbook/sqlite-transactions-csharp/index.md): SQLite transactions in C# with OneLite: BeginTransaction, Commit and Rollback through ADO.NET, and WriteAsync, which commits or rolls back for you. A money transfer that commits and one that rolls back, with real output and a sqlite3 check.
