Wiki

Clone wiki

LiteStore / Home

Introduction

The main goal of this project was using a book for making CAPTCHA phrases. We needed a very tiny, light-weight WORM storing system with no foot print. Usual NoSQL libraries were not suitable, since they were equipped for being read/write systems, or even LINQ compatible ones which we did not need. Anyway, although the current version is suited for our needs, we may add more features, including LINQ capabilities soon to make the project mature and more usable for hakcers.

Getting Started

Using the library is very easy. The database structure is a list of fixed type records, recalling old 'record file' structure. That is, you must specify the type of the database when declaring the object:

using (var store = new SimpleWORMStore<Poem>(path, FileMode.Open))
{
}

As you may already guess, since the SimpleWORMStore object is disposable, we use 'using' statement for better coding. Obviously, the file would be closed after disposing the object. The other noticeable fact is the FileMode property with which you specify whether you are writing into the file (Only the first time) or you re just reading it (the remaining times to death!). The above line returns an IEnumerable<Poem> object with which you can do anything including LINQ querying.

using (var store = new SimpleWORMStore<Poem>(path, FileMode.Open))
{
    var inventory = (from item in store select item);
}

The other situation is when you want to write the file and create it for the first time. the FileMode can be both Append or Create, each of which give the same meaning as in a File.Open statement. After that, you can write objects using Save method.

using (var store = new SimpleWORMStore<Poem>(path, FileMode.Create))
{
    var poem = new Poem {/*the properties*/};
    store.Save(poem);
}

Anything seems easy right now. Happy coding and please gift me with adding issues in bug tracker.

Have fun!

Updated