Skip to main content

Definition

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

Syntax

CloudNimble.BlazorEssentials.TursoDb.TursoDbSet<TEntity>

Summary

Represents a collection of entities of a specific type in the database. Provides CRUD operations and querying capabilities.

Type Parameters

  • TEntity - The entity type this set manages.

Constructors

.ctor

Initializes a new instance of the TursoDbSet1` class.

Syntax

public TursoDbSet(CloudNimble.BlazorEssentials.TursoDb.TursoDatabase database)

Parameters

NameTypeDescription
databaseCloudNimble.BlazorEssentials.TursoDb.TursoDatabaseThe parent database.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when database is null.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Database

Gets the parent database.

Syntax

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

Property Value

Type: CloudNimble.BlazorEssentials.TursoDb.TursoDatabase

TableName

Gets the table name for this entity type.

Syntax

public string TableName { get; }

Property Value

Type: string

Methods

AddAsync

Adds a new entity to the table.

Syntax

public System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> AddAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity to add.

Returns

Type: System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> The execution result containing the last insert ID.

AddRangeAsync

Adds multiple entities to the table in a batch.

Syntax

public System.Threading.Tasks.Task<int> AddRangeAsync(System.Collections.Generic.IEnumerable<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.IEnumerable<TEntity>The entities to add.

Returns

Type: System.Threading.Tasks.Task<int> The number of entities added.

CountAsync

Gets the count of entities in the table.

Syntax

public System.Threading.Tasks.Task<int> CountAsync()

Returns

Type: System.Threading.Tasks.Task<int> The count of entities.

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

FindAsync

Finds an entity by its primary key.

Syntax

public System.Threading.Tasks.Task<TEntity> FindAsync(object key)

Parameters

NameTypeDescription
keyobjectThe primary key value.

Returns

Type: System.Threading.Tasks.Task<TEntity?> The entity if found, otherwise null.

FirstOrDefaultAsync

Gets the first entity matching the optional filter, or null if none.

Syntax

public System.Threading.Tasks.Task<TEntity> FirstOrDefaultAsync()

Returns

Type: System.Threading.Tasks.Task<TEntity?> The first entity or null.

FromSqlAsync

Executes a raw SQL query against this entity’s table.

Syntax

public System.Threading.Tasks.Task<System.Collections.Generic.List<TEntity>> FromSqlAsync(string sql, params object[] parameters)

Parameters

NameTypeDescription
sqlstringThe SQL query.
parametersobject?[]The query parameters.

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.List<TEntity>> A list of matching entities.

GetEntityMetadata

Syntax

public CloudNimble.BlazorEssentials.TursoDb.Schema.EntityMetadata GetEntityMetadata()

Returns

Type: CloudNimble.BlazorEssentials.TursoDb.Schema.EntityMetadata

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

OrderBy

Creates a query builder with an initial ORDER BY clause (ascending).

Syntax

public CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> OrderBy(string column)

Parameters

NameTypeDescription
columnstringThe column to order by.

Returns

Type: CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> A query builder for fluent query construction.

OrderByDescending

Creates a query builder with an initial ORDER BY clause (descending).

Syntax

public CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> OrderByDescending(string column)

Parameters

NameTypeDescription
columnstringThe column to order by.

Returns

Type: CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> A query builder for fluent query construction.

Query

Creates a new query builder for this entity set.

Syntax

public CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> Query()

Returns

Type: CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> A query builder for fluent query construction.

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

RemoveAsync

Removes an entity from the table.

Syntax

public System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> RemoveAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity to remove.

Returns

Type: System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> The execution result.

RemoveByKeyAsync

Removes an entity by its primary key.

Syntax

public System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> RemoveByKeyAsync(object key)

Parameters

NameTypeDescription
keyobjectThe primary key value.

Returns

Type: System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> The execution result.

RemoveRangeAsync

Removes multiple entities from the table.

Syntax

public System.Threading.Tasks.Task<int> RemoveRangeAsync(System.Collections.Generic.IEnumerable<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.IEnumerable<TEntity>The entities to remove.

Returns

Type: System.Threading.Tasks.Task<int> The number of entities removed.

ToListAsync

Retrieves all entities from the table.

Syntax

public System.Threading.Tasks.Task<System.Collections.Generic.List<TEntity>> ToListAsync()

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.List<TEntity>> A list of all entities.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?

UpdateAsync

Updates an existing entity in the table.

Syntax

public System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> UpdateAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity to update.

Returns

Type: System.Threading.Tasks.Task<CloudNimble.BlazorEssentials.TursoDb.TursoResult> The execution result.

Where

Creates a query builder with an initial WHERE clause.

Syntax

public CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> Where(string clause, params object[] parameters)

Parameters

NameTypeDescription
clausestringThe WHERE clause (e.g., “name = ?” or “age > ?”).
parametersobject?[]The parameters for the clause.

Returns

Type: CloudNimble.BlazorEssentials.TursoDb.Query.TursoQueryBuilder<TEntity> A query builder for fluent query construction.
  • CloudNimble.BlazorEssentials.TursoDb.ITursoDbSet