FdbTenantExtensions

Namespace: FoundationDB.Client · class

Methods

BeginReadOnlyTransaction

static IFdbReadOnlyTransaction BeginReadOnlyTransaction(IFdbTenant tenant, CancellationToken ct)

Start a new read-only transaction on this tenant

  • tenant — Tenant instance
  • ct — Optional cancellation token that can abort all pending async operations started by this transaction.

Returns: New transaction instance that can read from the tenant.

You MUST call Dispose() on the transaction when you are done with it. You SHOULD wrap it in a 'using' statement to ensure that it is disposed in all cases.

using(var tr = db.BeginReadOnlyTransaction(CancellationToken.None))
{
	var result = await tr.Get(Slice.FromString("Hello"));
	var items = await tr.GetRange(KeyRange.StartsWith(Slice.FromString("ABC"))).ToListAsync();
}

BeginTransaction

static IFdbTransaction BeginTransaction(IFdbTenant tenant, CancellationToken ct)

Start a new transaction on this tenant

  • tenant — Tenant instance
  • ct — Optional cancellation token that can abort all pending async operations started by this transaction.

Returns: New transaction instance that can read from or write to the tenant.

You MUST call Dispose() on the transaction when you are done with it. You SHOULD wrap it in a 'using' statement to ensure that it is disposed in all cases.

using(var tr = db.BeginTransaction(CancellationToken.None)) { tr.Set(Slice.FromString("Hello"), Slice.FromString("World")); tr.Clear(Slice.FromString("OldValue")); await tr.CommitAsync(); }