Skip to the content.

LiteDB-Wrapper

A simpler way to use LiteDB

Azure DevOps builds Nuget Nuget GitHub CodeFactor

How-To

NuGet

Add as reference

using LiteDB.Wrapper;
using LiteDB.Wrapper.Interface;

Create a collection reference

ICollectionRef<YourModel> reference = new  CollectionReference<YourModel>("mydatabase.db", "my_collection");

Available methods

Insert(T)
Insert(IList<T>)
Update(T)
Update(IList<T>)
Remove(Guid)
Remove(IList<Guid>)
Commit()
Get(Guid)
GetPaged(PageOptions, SortOptions)

Here’s an example usage

ICollectionRef<Model> reference = new CollectionReference<Model>(litedbloc, "insert_collection");
reference.Insert(new Model
{
	_ID = Guid.NewGuid(),
	Word = "Sample Word",
	Number = 99
});
await reference.Commit();

You have to invoke Commit() at the end to save your changes to LiteDB.

Note : As per LiteDB specs, you must decorate your model classes with BsonField attributes.

Contributors

Install the following to get started

IDE

  1. Visual Studio Code
  2. Visual Studio Community

Exntesions

  1. C# Language Extension for VSCode

Frameworks

  1. .NET

Do you want to contribute? Send me an email or DM me in twitter.