Skip to main content

Definition

Assembly: CloudNimble.BlazorEssentials.TursoDb.dll Namespace: CloudNimble.BlazorEssentials.TursoDb Inheritance: System.Object

Syntax

CloudNimble.BlazorEssentials.TursoDb.TursoTransaction

Summary

Represents a database transaction that can be committed or rolled back. Implements IAsyncDisposable for automatic rollback if not committed.

Examples

await using var transaction = await Database.BeginTransactionAsync();
try
{
    await Database.Users.AddAsync(user);
    await Database.Posts.AddAsync(post);
    await transaction.CommitAsync();
}
catch
{
    await transaction.RollbackAsync();
    throw;
}

Constructors

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Database

Gets the database this transaction belongs to.

Syntax

public CloudNimble.BlazorEssentials.TursoDb.TursoDatabase Database { get; }

Property Value

Type: CloudNimble.BlazorEssentials.TursoDb.TursoDatabase

IsCompleted

Gets whether the transaction has been completed (committed or rolled back).

Syntax

public bool IsCompleted { get; }

Property Value

Type: bool

Methods

CommitAsync

Commits the transaction, making all changes permanent.

Syntax

public System.Threading.Tasks.Task CommitAsync()

Returns

Type: System.Threading.Tasks.Task

Exceptions

ExceptionDescription
InvalidOperationExceptionThrown if the transaction is already completed.

DisposeAsync

Syntax

public System.Threading.Tasks.ValueTask DisposeAsync()

Returns

Type: System.Threading.Tasks.ValueTask

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

RollbackAsync

Rolls back the transaction, discarding all changes.

Syntax

public System.Threading.Tasks.Task RollbackAsync()

Returns

Type: System.Threading.Tasks.Task

Exceptions

ExceptionDescription
InvalidOperationExceptionThrown if the transaction is already completed.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?
  • System.IAsyncDisposable