Lith.DocStore 1.0.6648.17625

There is a newer version of this package available.
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                
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="Lith.DocStore" Version="1.0.6648.17625" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lith.DocStore --version 1.0.6648.17625                
#r "nuget: Lith.DocStore, 1.0.6648.17625"                
#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 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

  1. Models can live in a seperate project, which reduces the need for DTO project/objects.
  2. No setup apart from Creating your models
  3. Can be used instead of having the need to create a database when building a new project
  4. Any other benefits I couldn't think of.

Installation

nuget: install-package lith.docstore

Usage

  1. 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; }
    }
  1. 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; }
	}
  1. Add Record
  var shopA = new Shop
  {
      Category = "XX",
      Name = "SupermarketX"
  };

  using (var ctx = new ModelsContext())
  {
      ctx.Shops.Add(shopA);
      ctx.Save();
  }
  1. Query Record
  using (var ctx = new ModelsContext())
  {
      var results = from a in ctx.Shops
                    where a.Name == "SupermarketX"
                    && a.Category == "XX"
                    select a;
  }
  1. Find and Update Record
    using(var ctx = new ModelsContext())
    {
        var item = ctx.Shops.Find(id);
        item.Name = "DEF";

        ctx.Save();
    }
  1. Have a cold one 😉
Product 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. 
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.0.6651.23145 1,099 3/18/2018
1.0.6648.17625 877 3/15/2018
1.0.6646.20102 964 3/13/2018
1.0.6641.25245 925 3/8/2018
1.0.6641.17105 950 3/8/2018

Initial Release of Lith.DocStore