Immudb4DotNet 1.0.2
dotnet add package Immudb4DotNet --version 1.0.2
NuGet\Install-Package Immudb4DotNet -Version 1.0.2
<PackageReference Include="Immudb4DotNet" Version="1.0.2" />
paket add Immudb4DotNet --version 1.0.2
#r "nuget: Immudb4DotNet, 1.0.2"
// Install Immudb4DotNet as a Cake Addin #addin nuget:?package=Immudb4DotNet&version=1.0.2 // Install Immudb4DotNet as a Cake Tool #tool nuget:?package=Immudb4DotNet&version=1.0.2
Introduction
immudb4dotnet implements a grpc immudb client. A minimalist API is exposed for applications while cryptographic verifications and state update protocol implementation are fully implemented by this client.
Prerequisites
immudb4dotnet assumes an already running immudb server. Running immudb
is quite simple, please refer to the
following link for downloading and running it: https://docs.immudb.io/quickstart.html
Installation
Use NuGet package Immudb4DotNet
Supported Versions
immudb4dotnet supports the latest immudb release.
Step by step guide
Creating a Client
The following code snippets shows how to create a client.
Using default configuration:
var client = new CodeNotary.ImmuDb.ImmuClient("localhost"))
client implements IDisposable so you can wrap it with using
using (var client = new CodeNotary.ImmuDb.ImmuClient("localhost", 3322))
{
}
User sessions
Use LoginAsync
and LogoutAsync
methods to initiate and terminate user sessions. You can specify optional database name to be used by default. If database does not exists it will be created
await immuClient.LoginAsync("user", "password", "database");
// Interact with immudb using logged user
await immuClient.LogoutAsync();
alternativly you can call Close() to completele end your connection. After Logout() the same client can be used, but after Close() you have to create a new one. The Close() method called on dispose automatically
Creating a database
Creating a new database is quite simple:
immuClient.CreateDatabaseAsync("database");
Setting the active database
Specify the active database with:
immuClient.UseDatabaseAsync("database", false);
Second optional parameter indicates that database needs to be created if it's not exists. Default is true
Traditional read and write
immudb provides read and write operations that behave as a traditional key-value store i.e. no cryptographic verification is done. This operations may be used when validations can be post-poned:
await client.SetAsync("Key", "Value");
var result = await client.GetAsync("Key");
You can use generic methods that takes class as value. it will be serialized as json and written to immudb, and de-serialized on get
await client.SetAsync("key", new MyClass() { Property = "Value" });
var result = await client.GetAsync<MyClass>("key");
TryGet methods are also avaiable. They will not throw exceptions if specific key is missing in a database
if (await client.TryGet("key", out var value))
{
// use value
}
Verified or Safe read and write
immudb provides built-in cryptographic verification for any entry. The client implements the mathematical validations while the application uses as a traditional read or write operation:
try
{
await client.SafeSetAsync("key", "value");
var result = await client.SafeGetAsync("key");
}
catch (VerificationException e)
{
//TODO: tampering detected!
}
Closing the client
To programatically close the connection with immudb server use the shutdown
operation:
immuClient.Close();
Note: after shutdown, a new client needs to be created to establish a new connection.
Contributing
We welcome contributions. Feel free to join the team!
To report bugs or get help, use GitHub's issues.
Product | Versions 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. |
-
.NETStandard 2.0
- Google.Protobuf (>= 3.13.0)
- Grpc (>= 2.32.0)
- Microsoft.Extensions.Logging (>= 3.1.8)
- Microsoft.Extensions.Logging.Abstractions (>= 3.1.8)
- MSTest.TestFramework (>= 2.1.2)
- Newtonsoft.Json (>= 12.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.