Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

LiteDB - A .NET NoSQL Document Store in a Single Data File

0.00/5 (No votes)
14 Oct 2015 1  
Alternative VB.NET version of LiteDB - A .NET NoSQL Document Store in a single data file
In this post, you will find an alternative VB.NET version of a .NET NoSQL Document Store in a single data file called LiteDB.

Introduction

I thought this was an interesting article that might be relevent to VB.NET programmers for study and perhaps implementation.

A NoSQL (originally referring to "non SQL" or "non relational") database provides a mechanism for storage and retrieval of data that is modeled by means other than the tabular relations used in relational databases.  NoSQL databases are increasingly used in big data and real-time web applications.

Nothing could be more representative of the sudden shift to NoSQL than established companies such as Facebook, Google and Amazon.com against well-established relational database technologies. It almost seems like one day the web was was being driven by a few RDBMSs, and the next, five or so NoSQL solutions have established themselves as worthy solutions.

Having said all of that, the first thing we ought to do is explain what is meant by NoSQL. Where relational database vendors have historically tried to position their software as a one-size-fits-all solution, NoSQL leans towards smaller units of responsibility where the best tool for a given job is often times fluid. NoSQL is about being open and aware of alternative, existing and additional patterns and tools for managing your data.

For a more extensive look at NoSQL databases, please visit this link.

Background

LiteDB is a simple, fast and free embedded .NET NoSQL Document Store in a single data file. Inspired on MongoDB, supports collections, POCO classes, Bson Documents, indexes, stream data, ACID transactions, and LINQ expressions.

For detailed history and background, check out the original article at this link.

Understanding the Concepts

To get started, there are five simple concepts you need to understand.

  1. LiteDB has the same concept of a database which you are likely already familiar. Within a LiteDB instance, you can have zero or more databases (versions), each acting as high-level containers for everything else.
  2. A database can have zero or more collections. A collection shares enough in common with a traditional table that you can safely think of the two as the same thing.
  3. Collections are made up of zero or more documents. Again, a document can safely be thought of as a row.
  4. A document is made up of one or more fields, which you can probably guess are a lot like columns or Class Properties.
  5. Indexes in LiteDB function mostly like their RDBMS counterparts.

Points of Interest

The most difficult part of converting this project to VB.NET was the method below. VB uses a lot of conversion operators. I also had to turn off the option for Integer Overflow checking in the Project Properties to get this work:

History

  • 15th October, 2015: Initial version

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here