SimpleFileDB 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SimpleFileDB --version 1.0.2                
NuGet\Install-Package SimpleFileDB -Version 1.0.2                
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="SimpleFileDB" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleFileDB --version 1.0.2                
#r "nuget: SimpleFileDB, 1.0.2"                
#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.
// Install SimpleFileDB as a Cake Addin
#addin nuget:?package=SimpleFileDB&version=1.0.2

// Install SimpleFileDB as a Cake Tool
#tool nuget:?package=SimpleFileDB&version=1.0.2                

SimpleFileDB

SimpleFileDB is a free, fast, multiplatform, lightweight .NET Standard database library.

Databases are split into tables (stored as folders). Tables are split into rows (stored as JSON files). Rows are split into columns (stored as first-level properties in a JSON file).

Usage

using System;
using System.IO;

namespace SimpleFileDB.Sample
{
    class MySampleRowClass
    {
        public int Aaa = 346;
        public string Bbb = "Sample text.";
        public float Ccc = 3.14159f;
    }

    class SampleProgram
    {
        static async void Main(string[] args)
        {
            string pathdb = Path.GetTempFileName();
            File.Delete(pathdb);
            Directory.CreateDirectory(pathdb);
            Console.WriteLine($"Sample database created in {pathdb}");

            string table1_name = "my table";
            string table1_row1_index = "first row";
            string table1_row2_index = "second row";

            SimpleFileDB db = new SimpleFileDB(pathdb);

            db.CreateTable(table1_name);
            db[table1_name][table1_row1_index] = "the content of the first row is simply a string"; // create/update a row
            string row_read_back = await db[table1_name].GetRow<string>(table1_row1_index); // read a row - note: support for asynchronous operations
            Console.WriteLine($"The value of the first row is: \"{row_read_back}\".");

            db[table1_name][table1_row2_index] = new MySampleRowClass(); // create/update a row containing an object
            MySampleRowClass readvalue = db[table1_name].GetRow<MySampleRowClass>(table1_row2_index).Result; // read a row as an object, synchronously
            Console.WriteLine($"The second row contains a {nameof(MySampleRowClass)} object: Aaa={readvalue.Aaa}, Bbb={readvalue.Bbb}, Ccc={readvalue.Ccc}.");
            Console.WriteLine($"The second row has been stored as a JSON file with contents:{Environment.NewLine}{File.ReadAllText(Path.Combine(pathdb, table1_name, table1_row2_index))}");

            db[table1_name].Delete(table1_row1_index);
            db[table1_name].Delete(table1_row2_index);
            db.DeleteTable(table1_name, deletecontents: false);
        }
    }
}

Features

  • Extremely easy to use.
  • Multiplatform (platform agnostic).
  • Each row is a simply JSON file. Therefore it can be easily stored on disk, network share, Google Drive, OneDrive...
  • Row contents can be any serializable object. The value of a row can be an integer, a float, a string, or your own class.
  • Read/write operations are asynchronous, so DB access does not necessarily block the rest of your application.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.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.

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
1.3.4 300 2/14/2023
1.3.3 260 2/12/2023
1.3.2 277 2/12/2023
1.3.1 278 2/12/2023
1.3.0 273 2/12/2023
1.2.0 276 2/2/2023
1.1.0 292 1/31/2023
1.0.3 314 1/7/2023
1.0.2 363 5/21/2021
1.0.1 340 4/29/2021
1.0.0 343 4/29/2021