VOOZH about

URL: https://www.nuget.org/packages/BitBadger.Documents.Sqlite/

⇱ NuGet Gallery | BitBadger.Documents.Sqlite 4.2.0




👁 Image
BitBadger.Documents.Sqlite 4.2.0

dotnet add package BitBadger.Documents.Sqlite --version 4.2.0
 
 
NuGet\Install-Package BitBadger.Documents.Sqlite -Version 4.2.0
 
 
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="BitBadger.Documents.Sqlite" Version="4.2.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BitBadger.Documents.Sqlite" Version="4.2.0" />
 
Directory.Packages.props
<PackageReference Include="BitBadger.Documents.Sqlite" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BitBadger.Documents.Sqlite --version 4.2.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BitBadger.Documents.Sqlite, 4.2.0"
 
 
#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.
#:package BitBadger.Documents.Sqlite@4.2.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BitBadger.Documents.Sqlite&version=4.2.0
 
Install as a Cake Addin
#tool nuget:?package=BitBadger.Documents.Sqlite&version=4.2.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

BitBadger.Documents.Sqlite

This package provides a lightweight document library backed by SQLite. It also provides streamlined functions for traditional ADO.NET functionality where relational data is required. Both C# and F# have first-class implementations.

Features

  • Select, insert, update, save (upsert), delete, count, and check existence of documents, and create tables and indexes for these documents
  • Automatically generate IDs for documents (numeric IDs, GUIDs, or random strings)
  • Address documents via ID or via comparison on any field
  • Access documents as your domain models (<abbr title="Plain Old CLR Objects">POCO</abbr>s)
  • Use Task-based async for all data access functions
  • Use building blocks for more complex queries

Upgrading from v3

There is a breaking API change for ByField (C#) / byField (F#), along with a compatibility namespace that can mitigate the impact of these changes. See the migration guide for full details.

Getting Started

Once the package is installed, the library needs a connection string. Once it has been obtained / constructed, provide it to the library:

// C#
using BitBadger.Documents.Sqlite;

//...
Sqlite.Configuration.UseConnectionString("connection-string");

// A new, open connection to the database can be obtained via
// Sqlite.Configuration.DbConn()
// F#
open BitBadger.Documents.Sqlite

// ...
Configuration.useConnectionString "connection-string"

// A new, open connection to the database can be obtained via
// Configuration.dbConn ()

By default, the library uses a System.Text.Json-based serializer configured to use the FSharp.SystemTextJson converter. To provide a different serializer (different options, more converters, etc.), construct it to implement IDocumentSerializer and provide it via Configuration.useSerializer. If custom serialization makes the serialized Id field not be Id, that will also need to be configured.

Using

Retrieve all customers:

// C#; parameter is table name
// Find.All type signature is Func<string, Task<List<TDoc>>>
var customers = await Find.All<Customer>("customer");
// F#
// Find.all type signature is string -> Task<'TDoc list>
let! customers = Find.all<Customer> "customer"

Select a customer by ID:

// C#; parameters are table name and ID
// Find.ById type signature is Func<string, TKey, Task<TDoc?>>
var customer = await Find.ById<string, Customer>("customer", "123");
// F#
// Find.byId type signature is string -> 'TKey -> Task<'TDoc option>
let! customer = Find.byId<string, Customer> "customer" "123"

(keys are treated as strings in the database)

Count customers in Atlanta:

// C#; parameters are table name, field, operator, and value
// Count.ByFields type signature is Func<string, FieldMatch, IEnumerable<Field>, Task<long>>
var customerCount = await Count.ByFields("customer", FieldMatch.Any, [Field.Equal("City", "Atlanta")]);
// F#
// Count.byFields type signature is string -> FieldMatch -> Field seq -> Task<int64>
let! customerCount = Count.byFields "customer" Any [ Field.Equal "City" "Atlanta" ]

Delete customers in Chicago: (no offense, Second City; just an example...)

// C#; parameters are same as above, except return is void
// Delete.ByFields type signature is Func<string, FieldMatch, IEnumerable<Field>, Task>
await Delete.ByFields("customer", FieldMatch.Any, [Field.Equal("City", "Chicago")]);
// F#
// Delete.byFields type signature is string -> FieldMatch -> Field seq -> Task<unit>
do! Delete.byFields "customer" Any [ Field.Equal "City" "Chicago" ]

More Information

The project site has full details on how to use this library.

Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.2.0 146 12/30/2025
4.1.0 304 4/19/2025
4.0.1 192 12/30/2024
4.0.0 196 12/18/2024
4.0.0-rc5 201 9/18/2024
4.0.0-rc4 208 9/17/2024
4.0.0-rc3 234 8/23/2024
4.0.0-rc2 209 8/22/2024
4.0.0-rc1 205 8/19/2024
3.1.0 222 6/6/2024
3.0.0 242 4/21/2024
3.0.0-rc-2 323 1/24/2024
3.0.0-rc-1 235 12/31/2023

Add .NET 10 support; update dependencies, supported PostgreSQL versions