CsSqlite.Native 1.1.0

dotnet add package CsSqlite.Native --version 1.1.0
                    
NuGet\Install-Package CsSqlite.Native -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CsSqlite.Native" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CsSqlite.Native" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CsSqlite.Native" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CsSqlite.Native --version 1.1.0
                    
#r "nuget: CsSqlite.Native, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CsSqlite.Native@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CsSqlite.Native&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CsSqlite.Native&version=1.1.0
                    
Install as a Cake Tool

CsSqlite

Extremely fast, robust, and lightweight SQLite bindings for .NET and Unity

NuGet Releases license

English | 日本語

benchmark

CsSqlite is a highly performant and lightweight SQLite binding built in C#. It provides an API equivalent to Microsoft.Data.Sqlite (the foundation package for EFCore SQLite) while achieving high performance through carefully tuned implementations.

Features

  • Easy-to-use API
  • High-performance implementation leveraging Span<T> and Unsafe
  • Zero allocation, no additional memory allocation
  • No dependencies
  • Robust binding generation using Cysharp/csbindgen
  • Supports Unity (Mono, IL2CPP)

Installation

NuGet packages

CsSqlite requires .NET Standard 2.1 or later. The package is available on NuGet.

.NET CLI

dotnet add package CsSqlite

Package Manager

Install-Package CsSqlite

Unity

For Unity, installation is possible via the Package Manager.

  1. Open the Package Manager from Window > Package Manager
  2. Click the "+" button > Add package from git URL
  3. Enter the following URL:
https://github.com/nuskey8/CsSqlite.git?path=src/CsSqlite.Unity/Assets/CsSqlite.Unity

Alternatively, open Packages/manifest.json and add the following to the dependencies block:

{
    "dependencies": {
        "com.nuskey.sqlite3.unity": "https://github.com/nuskey8/CsSqlite.git?path=src/CsSqlite.Unity/Assets/CsSqlite.Unity"
    }
}

CsSqlite.Unity supports the following platforms:

Platform Architecture Supported Notes
Windows x64
x86
arm64
macOS x64
arm64 (Apple Silicon)
Universal (x64 + arm64)
Linux x64 ✅ (untested)
arm64 ✅ (untested)
iOS arm64
x64
Android arm64

Quick Start

using CsSqlite;

// Open a SqliteConnection
using var connection = new SqliteConnection("example.db");
connection.Open();

// Execute SQL
connection.ExecuteNonQuery("""
CREATE TABLE IF NOT EXISTS user (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    age INTEGER NOT NULL,
    name TEXT NOT NULL
);
""");

// Overload accepting UTF-8 text
connection.ExecuteNonQuery("""
INSERT INTO user (id, name, age)
VALUES (1, 'Alice', 18),
       (2, 'Bob', 32),
       (3, 'Charlie', 25);
"""u8);

// Create a reader
using var reader = connection.ExecuteReader("""
SELECT name
FROM user
""");

// Read values using Read() / GetXXX(column)
while (reader.Read())
{
    Console.WriteLine($"{reader.GetString(0)}!");
}

SqliteCommand

To reuse the same query, use SqliteCommand.

using var command = connection.CreateCommand("""
SELECT name
FROM user
""");

using var reader = command.ExecuteReader();

You can also add parameters to SqliteCommand.

using var command = conn.CreateCommand("INSERT INTO t(val) VALUES($foo);");
command.Parameters.Add("$foo", "foo");
command.ExecuteNonQuery();

Exception Handling

If any error occurs during execution, a SqliteException is thrown. You can handle exceptions by catching this.

try
{
    // ...
}
catch (SqliteException ex)
{
    Console.WriteLine(ex.ErrorCode);
    Console.WriteLine(ex.Message);
}

License

This library is provided under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CsSqlite.Native:

Package Downloads
CsSqlite

Extremely fast, robust, and lightweight SQLite bindings for .NET and Unity

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 155 9/25/2025
1.0.1 159 9/23/2025
1.0.0 165 9/23/2025