Darcy 1.1.17

dotnet add package Darcy --version 1.1.17
                    
NuGet\Install-Package Darcy -Version 1.1.17
                    
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="Darcy" Version="1.1.17" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Darcy" Version="1.1.17" />
                    
Directory.Packages.props
<PackageReference Include="Darcy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Darcy --version 1.1.17
                    
#r "nuget: Darcy, 1.1.17"
                    
#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.
#:package Darcy@1.1.17
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Darcy&version=1.1.17
                    
Install as a Cake Addin
#tool nuget:?package=Darcy&version=1.1.17
                    
Install as a Cake Tool

Darcy

Darcy is a synchronous, single file YAML based database library targeting .NET 7 and up. Darcy is dead simple, only depending on YamlDotNet for what it does.

Data is stored in what are called "Baskets", a class that can hold an arbitrary amount of keys whose values are dynamic objects. This is useful for the likes of holding user facing data such as configuration files, or generally holding data to be used later or between program runs.

Example

For a runnable example, see DarcyDemo, here's the syntax of how baskets work.

// Create a new basket called "users", saved as "users.json"
var Users = new Basket("users", Autostore: true);
// Technically there's no "0" entry yet, when this function is called, it internally creates an ExpandoObject
var user = Users.GetKey("0");
user.name = "Darcy Gale";
user.gender = "Unknown";
// Properties can be overwritten easily and will be reflected upon through a file change, since Autostore is enabled.
user.gender = "Female";
// Let's get funky with some different data types, it supports as much as YamlDotNet and the yaml specification does.
user.possessions = new List<String>() { "Red Hoodie", "Basket", "Smartphone" };
user.birthdate = DateTime.Parse("06-10-1960");
user.age = null;
user.chance_of_spontaneous_combustion = 0.0000000000000001f;

outputs the following YAML file:

0:
  name: Darcy Gale
  gender: Female
  birthdate: 1960-06-10T00:00:00.0000000
  age: 
  possessions:
  - Red Hoodie
  - Basket
  - Smartphone
  chance_of_spontaneous_combustion: 1E-16

Data is saved automatically to the basket by default, but you can explicitly set Autostore to false and then use Users.save() to commit your changes to the basket.

Installation

Install Darcy from the NuGet repository.

FAQ

Q: Why the name Darcy and why Baskets?

The whole idea was remniscent of a character I wrote named Darcy. She owns a basket which allows her to take anything out from it, so long as it exists somewhere. Baskets in this library are a lot like that; as long as it exists in the yaml file, you can get it, with the obvious benefit of adding your own data programmatically.

Q: What brought you to making this?

I wanted something to easily store as much data as I can into somewhere human readable with loose syntax.

Licensing

Check out LICENSE.txt

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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.1.17 325 4/16/2023
1.0.1047 287 4/13/2023