A robust and extensible library for seamless interaction with SQLite databases. This library provides essential utilities for database connection management, schema initialization, and CRUD operations, offering an efficient and reliable foundation for applications requiring SQLite data persistence.
$ dotnet add package Potato.SQLiteThe Potato.SQLite library is a helper class designed to simplify interactions with SQLite databases in .NET applications.
It supports database initialization, data manipulation (CRUD operations), and utility functions for SQLite.
Potato.SQLite class to your project.System.Data.SQLite NuGet package installed.dotnet add package System.Data.SQLite
using Potato.SQLite;
// With base image URI
var helper = new Helper("C:\\databases", "example.db", new Uri("http://example.com/images"));
// Without base image URI
var helperWithoutImage = new Helper("C:\\databases", "example.db");
var data = new List<Dictionary<string, object>>
{
new Dictionary<string, object> { { "Name", "Potato" }, { "Type", "Vegetable" } },
new Dictionary<string, object> { { "Name", "Tomato" }, { "Type", "Fruit" } },
};
await helper.InsertDataAsync("Products", data);
int lastId = await helper.InsertReturnDataAsync("Products", data);
Console.WriteLine($"Last inserted ID: {lastId}");
var rows = await helper.ReadAllDataAsync("Products");
foreach (var row in rows)
{
Console.WriteLine(string.Join(", ", row.Select(kvp => $"{kvp.Key}: {kvp.Value}")));
}
var conditions = new Dictionary<string, object> { { "Type", "Vegetable" } };
var rowsWithConditions = await helper.ReadDataAsync("Products", conditions);
var updatedValues = new Dictionary<string, object> { { "Name", "Sweet Potato" } };
var conditions = new Dictionary<string, object> { { "Name", "Potato" } };
await helper.UpdateDataAsync("Products", updatedValues, conditions);
var conditions = new Dictionary<string, object> { { "Name", "Potato" } };
await helper.DeleteDataAsync("Products", conditions);
Contributions are welcome! If you encounter a bug or want to add new features, feel free to submit a pull request or file an issue.
This project is licensed under the MIT License.