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).
usingSystem;usingSystem.IO;namespaceSimpleFileDB.Sample{classMySampleRowClass{publicintAaa=346;publicstringBbb="Sample text.";publicfloatCcc=3.14159f;}classSampleProgram{staticasyncvoidMain(string[]args){stringpathdb=Path.GetTempFileName();File.Delete(pathdb);Directory.CreateDirectory(pathdb);Console.WriteLine($"Sample database created in {pathdb}");stringtable1_name="my table";stringtable1_row1_index="first row";stringtable1_row2_index="second row";SimpleFileDBdb=newSimpleFileDB(pathdb);db.CreateTable(table1_name);db[table1_name][table1_row1_index]="the content of the first row is simply a string";// create/update a rowstringrow_read_back=awaitdb[table1_name].GetRow<string>(table1_row1_index);// read a row - note: support for asynchronous operationsConsole.WriteLine($"The value of the first row is: \"{row_read_back}\".");db[table1_name][table1_row2_index]=newMySampleRowClass();// create/update a row containing an objectMySampleRowClassreadvalue=db[table1_name].GetRow<MySampleRowClass>(table1_row2_index).Result;// read a row as an object, synchronouslyConsole.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);}}}- 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.