Definition
Assembly: CloudNimble.BlazorEssentials.TursoDb.dll Namespace: CloudNimble.BlazorEssentials.TursoDb Inheritance: System.ObjectSyntax
Summary
Base class for Turso databases. Inherit from this class and addTursoDbSet1` properties for each entity type.
Examples
Constructors
.ctor Inherited
Inherited from
objectSyntax
Properties
AuthToken
Gets or sets the authentication token for remote Turso databases.Syntax
Property Value
Type:string?
AutoCreateSchema
Gets or sets whether to automatically create tables on connect.Syntax
Property Value
Type:bool
DbSets
Gets the list of DbSets in this database.Syntax
Property Value
Type:System.Collections.Generic.List<CloudNimble.BlazorEssentials.TursoDb.ITursoDbSet>
IsConnected
Gets whether the database is currently connected.Syntax
Property Value
Type:bool
Name
Gets or sets the database name/identifier. This is used as the connection key in JavaScript.Syntax
Property Value
Type:string
Url
Gets or sets the database URL. Use “:memory:” for in-memory, “file:name.db” for local file, or a Turso cloud URL.Syntax
Property Value
Type:string
Methods
BeginTransactionAsync
Begins a new database transaction.Syntax
Returns
Type:System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoTransaction>
A transaction that can be committed or rolled back.
Examples
ConnectAsync
Connects to the database.Syntax
Returns
Type:System.Threading.Tasks.Task
A task representing the asynchronous operation.
DisconnectAsync
Disconnects from the database.Syntax
Returns
Type:System.Threading.Tasks.Task
A task representing the asynchronous operation.
DisposeAsync
Syntax
Returns
Type:System.Threading.Tasks.ValueTask
EnsureConnectedAsync
Ensures the database is connected, connecting if necessary.Syntax
Returns
Type:System.Threading.Tasks.Task
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ExecuteAsync
Executes a SQL statement and returns the result.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
sql | string | The SQL statement to execute. |
parameters | object?[] | The parameters for the SQL statement. |
Returns
Type:System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult>
The execution result.
ExecuteBatchAsync
Executes multiple SQL statements in a batch.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
statements | (string, object?[])[] | The statements to execute. |
Returns
Type:System.Threading.Tasks.Task<System.Collections.Generic.List<CloudNimble.BlazorEssentials.TursoDb.TursoResult>>
The results of each statement.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
Prepare
Creates a prepared statement for queries that return results.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
sql | string | The SQL query to prepare. |
Returns
Type:CloudNimble.BlazorEssentials.TursoDb.TursoPreparedStatement<TResult>
A prepared statement that can be executed multiple times.
Type Parameters
TResult- The type of result returned by the query.
Prepare
Creates a prepared statement for non-query commands.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
sql | string | The SQL command to prepare. |
Returns
Type:CloudNimble.BlazorEssentials.TursoDb.TursoPreparedStatement
A prepared statement that can be executed multiple times.
QueryAsync
Executes a SQL query and returns all matching rows.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
sql | string | The SQL query to execute. |
parameters | object?[] | The parameters for the SQL query. |
Returns
Type:System.Threading.Tasks.Task<System.Collections.Generic.List<T>>
A list of results.
Type Parameters
T- The type to deserialize results into.
QuerySingleAsync
Executes a SQL query and returns the first matching row or null.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
sql | string | The SQL query to execute. |
parameters | object?[] | The parameters for the SQL query. |
Returns
Type:System.Threading.Tasks.Task<T?>
The first result or default.
Type Parameters
T- The type to deserialize the result into.
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Related APIs
- System.IAsyncDisposable