P41.NoSQLite
0.1.0-beta.8
See the version list below for details.
dotnet add package P41.NoSQLite --version 0.1.0-beta.8
NuGet\Install-Package P41.NoSQLite -Version 0.1.0-beta.8
<PackageReference Include="P41.NoSQLite" Version="0.1.0-beta.8" />
paket add P41.NoSQLite --version 0.1.0-beta.8
#r "nuget: P41.NoSQLite, 0.1.0-beta.8"
// Install P41.NoSQLite as a Cake Addin #addin nuget:?package=P41.NoSQLite&version=0.1.0-beta.8&prerelease // Install P41.NoSQLite as a Cake Tool #tool nuget:?package=P41.NoSQLite&version=0.1.0-beta.8&prerelease
NoSQLite: NoSQL on top of SQLite
A thin wrapper above sqlite to use it as a nosql database.
Getting Started
All you need is an instance of NoSQLiteConnection
. The instance requires a string
that is a fully qualified path to the database file and you can also optionally provide your own JsonSerializerOptions
to configure the JSON serialization/deserialization.
NoSQLiteConnection
creates and opens a connection when initialized so keep in mind that you will have to dispose it when you are done. Use the Dispose
method of the IDisposable interface
.
In most scenarios you will create it and store it for use until you shutdown your application.
The sqlite
database is configured with journal_mode
set to WAL
.
How It Works
It works by taking advantage of the JSON1 through the SQLitePCLRaw.bundle_e_sqlite3 nuget package that forces the correct version of sqlite to manipulate the documents, create indexes and more in the future!
Document Management
Example class that will be used below:
public class Person
{
public string Name { get; set; }
public string Surname { get; set; }
public string? Description { get; set; }
}
and the same connection:
var db = new NoSQLiteConnection("path to database file", "json options or null");
Create/Update documents.
Creating or Updating a document happens from the same insert
method, keep in mind that this always replaces the document with the new one.
var panos = new Person
{
Name = "panoukos",
Surname = "41",
Description = "C# dev"
}
db.Insert("panos", panos); // If it exists it is now replaced/updated.
Get documents.
var doc = db.Get<Person>("panos");
Delete documents.
db.Remove("panos"); // Will remove the document.
db.Remove("panos"); // Will still succeed even if the document doesn't exist.
Build
To build this project .NET 7 is needed.
Contribute
Contributions are welcome and appreciated, before you create a pull request please open a GitHub Issue to discuss what needs changing and or fixing if the issue doesn't exist!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 was computed. 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. |
-
net6.0
- SQLitePCLRaw.bundle_e_sqlite3 (>= 2.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.0-beta.0 | 97 | 7/15/2023 |
0.3.0-beta.-1 | 90 | 7/14/2023 |
0.2.0-beta.3 | 91 | 4/27/2023 |
0.2.0-beta.1 | 111 | 11/12/2022 |
0.1.0-beta.8 | 133 | 10/19/2022 |
0.1.0-beta.4 | 113 | 10/14/2022 |
0.1.0-beta.3 | 108 | 10/13/2022 |
0.1.0-beta.1 | 144 | 9/22/2022 |