Lith.DocStore
1.0.6648.17625
See the version list below for details.
dotnet add package Lith.DocStore --version 1.0.6648.17625
NuGet\Install-Package Lith.DocStore -Version 1.0.6648.17625
<PackageReference Include="Lith.DocStore" Version="1.0.6648.17625" />
paket add Lith.DocStore --version 1.0.6648.17625
#r "nuget: Lith.DocStore, 1.0.6648.17625"
// Install Lith.DocStore as a Cake Addin #addin nuget:?package=Lith.DocStore&version=1.0.6648.17625 // Install Lith.DocStore as a Cake Tool #tool nuget:?package=Lith.DocStore&version=1.0.6648.17625
Lith.DocStore
A document database in the most literal case.
This document storage could be used to create quick prototypes without the need of connecting to an actual database. Lith.DocStore provides interfaces that allow you to create physical data files which can be JSON, XML or anything you can serialize.
The idea behind this is that you can run unit tests against models and logic without commiting to a database or having a connection.
Benefits
- Models can live in a seperate project, which reduces the need for DTO project/objects.
- No setup apart from Creating your models
- Can be used instead of having the need to create a database when building a new project
- Any other benefits I couldn't think of.
Installation
nuget: install-package lith.docstore
Usage
- Create Models
public abstract class BaseRecord : IStoreable
{
public Guid ID { get; set; }
public DateTime DateCreated { get; set; }
public bool IsDeleted { get; set; }
}
public class Transaction : BaseRecord
{
public bool IsExpense { get; set; }
public Shop Shop { get; set; }
public decimal Amount { get; set; }
public DateTime Date { get; set; }
}
- Setup Context
public class ModelsContext : StoreContext
{
public ModelsContext()
: base(new JSONModelHelper())
{
}
public ItemSet<Shop> Shops { get; set; }
public ItemSet<Transaction> Transactions { get; set; }
public ItemSet<Summary> Summaries { get; set; }
}
- Add Record
var shopA = new Shop
{
Category = "XX",
Name = "SupermarketX"
};
using (var ctx = new ModelsContext())
{
ctx.Shops.Add(shopA);
ctx.Save();
}
- Query Record
using (var ctx = new ModelsContext())
{
var results = from a in ctx.Shops
where a.Name == "SupermarketX"
&& a.Category == "XX"
select a;
}
- Find and Update Record
using(var ctx = new ModelsContext())
{
var item = ctx.Shops.Find(id);
item.Name = "DEF";
ctx.Save();
}
- Have a cold one 😉
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Newtonsoft.Json (>= 10.0.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 |
---|---|---|
1.0.6651.23145 | 1,099 | 3/18/2018 |
1.0.6648.17625 | 877 | 3/15/2018 |
1.0.6646.20102 | 966 | 3/13/2018 |
1.0.6641.25245 | 925 | 3/8/2018 |
1.0.6641.17105 | 950 | 3/8/2018 |
Initial Release of Lith.DocStore