LiteDB.Async 0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package LiteDB.Async --version 0.0.2                
NuGet\Install-Package LiteDB.Async -Version 0.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LiteDB.Async" Version="0.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LiteDB.Async --version 0.0.2                
#r "nuget: LiteDB.Async, 0.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LiteDB.Async as a Cake Addin
#addin nuget:?package=LiteDB.Async&version=0.0.2

// Install LiteDB.Async as a Cake Tool
#tool nuget:?package=LiteDB.Async&version=0.0.2                

How to use

Installation

Include the nuget package in your project in the usual way

Install-Package LiteDB.Async

or

dotnet add package LiteDB.Async

Collections

Open a LiteDbAsync instance by calling the constructor in the standard way.

var db = new LiteDatabaseAsync("Filename=mydatabase.db;Connection=shared;Password=hunter2");

Collections are the equivalent of tables

var collection = _db.GetCollection<SimplePerson>();

This will give us an instance of the collection we can read and write.

We can upsert just like in the regular LiteDb

var collection = _db.GetCollection<SimplePerson>();
            var person = new SimplePerson()
            {
                Id = Guid.NewGuid(),
                FirstName = "John",
                LastName = "Smith"
            };

            var upsertResult = await collection.UpsertAsync(person);

Queries

When we want to read from the database we should use a query.

To read all SimplePerson's in the database

var collection = _db.GetCollection<SimplePerson>();
var listResult = await collection.Query().ToListAsync();

Supported API

Almost all functions from LiteDb have an async replacement

From Collections

Query, CountAsync, LongCountAsync, ExistsAsync, MinAsync, MaxAsync, DeleteAsync, DeleteManyAsync, FindAsync, FindByIdAsync, FindOneAsync, FindAllAsync, Include, EnsureIndexAsync, InsertAsync, UpdateAsync, UpdateManyAsync, UpsertAsync

From Query

Include, Where, OrderBy, OrderByDescending, GroupBy, Select, Limit, Skip, Offset, ForUpdate, ToDocumentsAsync, ToEnumerableAsync, ToListAsync, ToArrayAsync, FirstAsync, FirstOrDefaultAsync, SingleAsync, SingleOrDefaultAsync, CountAsync, LongCountAsync, ExistsAsync

How does it work?

The constructor LiteDatabaseAsync opens and wraps a LiteDB instant. It also starts a background thread which all actions are performed in.

When a function that causes an evaluation is called it sends a message to the background thread, where the required action is performed by the LiteDb instance. The result is then return to the calling thread when the function in the background completes. If the function in the background thread causes an exception it is caught and a LiteAsyncException is raised. The original exception is preserved as the InnerException.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

NuGet packages (12)

Showing the top 5 NuGet packages that depend on LiteDB.Async:

Package Downloads
Fluxera.Repository.LiteDB

A LiteDB repository implementation.

LiteDB.Queryable

An IQueryable wrapper implementation for LiteDB with additional async extensions.

LiteDB.Identity.Async

Uses the LiteDB.Identity and combines it with LiteDB.async

Serilog.Sinks.LiteDb.Async

Serilog event sink that writes to LiteDb database

Modern.Repositories.LiteDB.Async

A generic repository implementation using LiteDb Async for CRUD and Query operations

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on LiteDB.Async:

Repository Stars
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
mlockett42/litedb-async
This library allows the use of asynchronous programming techniques with the LiteDb library
Version Downloads Last updated
0.1.8 7,436 6/26/2024
0.1.7 33,713 8/5/2023
0.1.6 10,406 3/17/2023
0.1.5 21,542 1/21/2023
0.1.4 905 1/16/2023
0.1.3 978 1/10/2023
0.1.2 4,894 12/20/2022
0.1.1 26,536 8/18/2022
0.1.0 19,828 3/19/2022
0.0.11 30,245 9/7/2021
0.0.10 1,631 8/22/2021
0.0.9 1,801 7/24/2021
0.0.8 4,708 1/13/2021
0.0.7 1,608 10/28/2020
0.0.6 904 10/23/2020
0.0.5 761 10/14/2020
0.0.4 1,263 9/26/2020
0.0.3 748 9/24/2020
0.0.2 973 5/24/2020
0.0.1 908 5/23/2020