SQLite implementation of Birko.Data.SQL stores and repositories.
- SQLite stores (sync/async, single/bulk)
- Embedded database (no server required)
- File-based and in-memory database support
- Transaction-based bulk operations
dotnet add package Birko.Data.SQL.SqLite- Birko.Data.Core (AbstractModel)
- Birko.Data.Stores (store interfaces, Settings)
- Birko.Data.SQL
- Microsoft.Data.Sqlite (migrated from System.Data.SQLite)
This project now uses Microsoft.Data.Sqlite instead of System.Data.SQLite. If upgrading:
- Replace
using System.Data.SQLite;withusing Microsoft.Data.Sqlite; - Rename types:
SQLiteConnection->SqliteConnection,SQLiteCommand->SqliteCommand,SQLiteParameter->SqliteParameter,SQLiteException->SqliteException - Remove
Version=3from connection strings
using Birko.Data.SQL.SqLite.Stores;
public class CustomerStore : SqLiteStore<Customer>
{
public override Guid Create(Customer item)
{
var cmd = Connector.CreateCommand();
cmd.CommandText = "INSERT INTO customers (id, name, email) VALUES (@Id, @Name, @Email)";
cmd.Parameters.AddWithValue("@Id", item.Id);
cmd.Parameters.AddWithValue("@Name", item.Name);
cmd.Parameters.AddWithValue("@Email", item.Email);
cmd.ExecuteNonQuery();
return item.Id;
}
}Data Source=path/to/database.db; -- File-based
Data Source=:memory:; -- In-memory
- SqLiteStore<T> - Sync store
- SqLiteBulkStore<T> - Bulk operations (transaction-based)
- AsyncSqLiteStore<T> - Async store
- AsyncSqLiteBulkStore<T> - Async bulk store
- SqLiteRepository<T> / SqLiteBulkRepository<T>
- AsyncSqLiteRepository<T> / AsyncSqLiteBulkRepository<T>
- SqLiteConnector - SQLite connection management
- Birko.Data.SQL - SQL base classes
Part of the Birko Framework.