Couchbase.Lite.Support.WinUI
3.2.0
Prefix Reserved
dotnet add package Couchbase.Lite.Support.WinUI --version 3.2.0
NuGet\Install-Package Couchbase.Lite.Support.WinUI -Version 3.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="Couchbase.Lite.Support.WinUI" Version="3.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Couchbase.Lite.Support.WinUI --version 3.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Couchbase.Lite.Support.WinUI, 3.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.
// Install Couchbase.Lite.Support.WinUI as a Cake Addin #addin nuget:?package=Couchbase.Lite.Support.WinUI&version=3.2.0 // Install Couchbase.Lite.Support.WinUI as a Cake Tool #tool nuget:?package=Couchbase.Lite.Support.WinUI&version=3.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Couchbase Lite .NET
Couchbase Lite is a lightweight embedded NoSQL database that has built-in sync to larger backend structures, such as Couchbase Server.
This is the source repo of Couchbase Lite C#. The main supported platforms are .NET 6 Desktop (Linux will run anywhere, but is most tested on Ubuntu), .NET 8 iOS, .NET 8 Android, .NET 8 Mac Catalyst, .NET 8 WinUI, Xamarin iOS, and Xamarin Android.
Documentation Overview
- Official Documentation
- API References - See the release notes for each release on this repo
Getting Started
The following starter code demonstrates the basic concepts of the library:
using System;
using Couchbase.Lite;
using Couchbase.Lite.Query;
using Couchbase.Lite.Sync;
// Get the database (and create it if it doesn't exist)
var database = new Database("mydb");
var collection = database.GetDefaultCollection();
// Create a new document (i.e. a record) in the database
var id = default(string);
using var createdDoc = new MutableDocument();
createdDoc.SetFloat("version", 2.0f)
.SetString("type", "SDK");
// Save it to the database
collection.Save(createdDoc);
id = createdDoc.Id;
// Update a document
using var doc = collection.GetDocument(id);
using var mutableDoc = doc.ToMutable();
createdDoc.SetString("language", "C#");
collection.Save(createdDoc);
using var docAgain = collection.GetDocument(id);
Console.WriteLine($"Document ID :: {docAgain.Id}");
Console.WriteLine($"Learning {docAgain.GetString("language")}");
// Create a query to fetch documents of type SDK
// i.e. SELECT * FROM database WHERE type = "SDK"
using var query = QueryBuilder.Select(SelectResult.All())
.From(DataSource.Collection(collection))
.Where(Expression.Property("type").EqualTo(Expression.String("SDK")));
// Alternatively, using SQL++, with _ referring to the database
using var sqlppQuery = collection.CreateQuery("SELECT * FROM _ WHERE type = 'SDK'");
// Run the query
var result = query.Execute();
Console.WriteLine($"Number of rows :: {result.AllResults().Count}");
// Create replicator to push and pull changes to and from the cloud
var targetEndpoint = new URLEndpoint(new Uri("ws://localhost:4984/getting-started-db"));
var replConfig = new ReplicatorConfiguration(targetEndpoint);
replConfig.AddCollection(database.GetDefaultCollection());
// Add authentication
replConfig.Authenticator = new BasicAuthenticator("john", "pass");
// Create replicator
var replicator = new Replicator(replConfig);
replicator.AddChangeListener((sender, args) =>
{
if (args.Status.Error != null) {
Console.WriteLine($"Error :: {args.Status.Error}");
}
});
replicator.Start();
// Later, stop and dispose the replicator *before* closing/disposing the database
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows10.0.19041 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0-windows10.0.19041
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.