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.
Branch | Status |
---|---|
master | |
develop |
Install-Package SoSimpleDb
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.
var person = new Person() { Id = 1, FirstName = "Peter", LastName = "Smith" };
SoSimpleDb<Person>.Instance.Insert(person);
var persons = new List<Person>();
//Fill your collection with instances of you model class
SoSimpleDb<Person>.Instance.Insert(persons);
SoSimpleDb<Person>.Instance.Update(myInstanceOfPerson);
SoSimpleDb<Person>.Instance.Delete(myInstanceOfPerson.Id);
var persons = SoSimpleDb<Person>.Instance.SelectAll();
var person = SoSimpleDb<Person>.Instance.Select(1);
Func<Person, bool> searchFunc = (x) => x.LastName.Contains("Smith");
var persons = SoSimpleDb<Person>.Instance.Select(searchFunc);
var personCount = SoSimpleDb<Person>.Instance.Count();
Calm down. It's stored in a JSON file named Data.ssdb
located by default in the path of your executing assembly.
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"/>