Lith.DocStore 1.0.6651.23145

Persist data to json or xml files.

Install-Package Lith.DocStore -Version 1.0.6651.23145
dotnet add package Lith.DocStore --version 1.0.6651.23145
<PackageReference Include="Lith.DocStore" Version="1.0.6651.23145" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lith.DocStore --version 1.0.6651.23145
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 ;)

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 ;)

Release Notes

Initial Release of Lith.DocStore

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.6651.23145 257 3/18/2018
1.0.6648.17625 197 3/15/2018
1.0.6646.20102 229 3/13/2018
1.0.6641.25245 209 3/8/2018
1.0.6641.17105 246 3/8/2018