Skip to content

A simple way to store data in your applications. If you want to store collections and you don't want to deal with SQL or avoid learning NoSQL, SoSimpleDb is made for you.

License

YoannBureau/SoSimpleDb

Repository files navigation

SoSimpleDb

A simple way to store data in your applications. If you want to store collections and you don't want to deal with SQL or avoid learning NoSQL, SoSimpleDb is made for you.

Build Status: Build status

Branches

Branch Status
master Build status
develop Build status

Install

Install-Package SoSimpleDb

How to use

Assuming the following class:

public class Person : SoSimpleDbModelBase
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

Note : Your model classes must inherit from the SoSimpleDbModelBase abstract class. That simply adds an Id property on your class definition.

Insert

var person = new Person() { Id = 1, FirstName = "Peter", LastName = "Smith" };
SoSimpleDb<Person>.Instance.Insert(person);

Insert many

var persons = new List<Person>();
//Fill your collection with instances of you model class
SoSimpleDb<Person>.Instance.Insert(persons);

Update

SoSimpleDb<Person>.Instance.Update(myInstanceOfPerson);

Delete

SoSimpleDb<Person>.Instance.Delete(myInstanceOfPerson.Id);

SelectAll

var persons = SoSimpleDb<Person>.Instance.SelectAll();

Select by Id

var person = SoSimpleDb<Person>.Instance.Select(1);

Select by Func

Func<Person, bool> searchFunc = (x) => x.LastName.Contains("Smith");
var persons = SoSimpleDb<Person>.Instance.Select(searchFunc);

Count

var personCount = SoSimpleDb<Person>.Instance.Count();

Where the hell my data is stored?

Calm down. It's stored in a JSON file named Data.ssdb located by default in the path of your executing assembly.

Add a custom path for the storage file

Simply add a new AppSetting in your application configuration file with the SoSimpleDb.CustomFileStoragePath key. For example:

<add key="SoSimpleDb.CustomFileStoragePath" value="C:\Users\MyUser\Documents\test.ssdb"/>

About

A simple way to store data in your applications. If you want to store collections and you don't want to deal with SQL or avoid learning NoSQL, SoSimpleDb is made for you.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published