Skip to content

.NET Core temporary JSON storage for those times when you want persistent storage without a SQL database, etc.

Notifications You must be signed in to change notification settings

ShawnTheBeachy/j-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

JStore

.NET Core temporary JSON storage for those times when you want persistent storage without a SQL database, etc.

Nuget

Usage

All you need to use JStore is a Repository.

using JStore;

var intRepository = new Repository<int>();

And that quickly, you're up and running!

Reading items

Each repository holds an in-memory list of items. You can access it via the Items property.

var integers = intRepository.Items;

Adding and removing items

Because the Items property is just a List<T> you can add, remove, and insert items just like normal.

intRepository.Items.Add(10);

Saving

Your changes to your item list will not actually be saved to the backing JSON file until you tell the repository to save its item list.

await intRepository.SaveAsync();

Dependency injection

If you're using ASP.NET Core and want to inject your repositories, just call services.AddJStore(); in your startup method. Now you can inject any repository you please!

Notes

The performance of JStore could be improved. However, since it is not intended to be used as long-term or production storage, I am leaving it as-is for now. It serves its purpose, which is to provide persistent storage for a small data-set when you are in the prototyping stage and just want persistent storage for testing without all the overhead of using, say, a SQL database.

About

.NET Core temporary JSON storage for those times when you want persistent storage without a SQL database, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages