Class Table<TEntity>
A Table<TEntity> is used to perform CRUD operations against the table represented by TEntity
.
Inherited Members
Namespace: Venflow
Assembly: Venflow.dll
Syntax
public sealed class Table<TEntity> : TableBase<TEntity>, ITable where TEntity : class, new()
Type Parameters
Name | Description |
---|---|
TEntity | The entity which represents a table in the Database. |
Methods
| Improve this Doc View SourceCountAsync(CancellationToken)
Asynchronously counts the total rows the current table.
Declaration
public Task<long> CountAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<Int64> | A task representing the asynchronous operation, with the number of rows. |
Remarks
This method represents the following SQL statement "SELECT COUNT(*) FROM table".
Delete()
Creates a new delete command.
Declaration
public IDeleteCommandBuilder<TEntity> Delete()
Returns
Type | Description |
---|---|
IDeleteCommandBuilder<TEntity> | A Fluent API Builder for a delete command. |
Remarks
The command will be automatically disposed the underlying
Delete(Boolean)
Creates a new delete command.
Declaration
public IDeleteCommandBuilder<TEntity> Delete(bool disposeCommand)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposeCommand | Indicates whether or not to dispose the underlying |
Returns
Type | Description |
---|---|
IDeleteCommandBuilder<TEntity> | A Fluent API Builder for a delete command. |
DeleteAsync(TEntity, CancellationToken)
Asynchronously deletes the provided entity by its defined primary key.
Declaration
public ValueTask<int> DeleteAsync(TEntity entity, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | A |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<Int32> | A task representing the asynchronous operation, with the number of rows deleted. |
Remarks
This method represents the following SQL statement "DELETE FROM table WHERE pk = 0". This API is using parameterized commands.
DeleteAsync(TEntity[], CancellationToken)
Asynchronously deletes the provided entities by their defined primary keys.
Declaration
public ValueTask<int> DeleteAsync(TEntity[] entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TEntity[] | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<Int32> | A task representing the asynchronous operation, with the number of rows deleted. |
Remarks
This method represents the following SQL statement "DELETE FROM table WHERE pk = 0". This API is using parameterized commands.
DeleteAsync(IEnumerable<TEntity>, CancellationToken)
Asynchronously deletes the provided entities by their defined primary keys.
Declaration
public ValueTask<int> DeleteAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<Int32> | A task representing the asynchronous operation, with the number of rows deleted. |
Remarks
This method represents the following SQL statement "DELETE FROM table WHERE pk = 0". This API is using parameterized commands.
DeleteAsync(IList<TEntity>, CancellationToken)
Asynchronously deletes the provided entities by their defined primary keys.
Declaration
public ValueTask<int> DeleteAsync(IList<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IList<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<Int32> | A task representing the asynchronous operation, with the number of rows deleted. |
Remarks
This method represents the following SQL statement "DELETE FROM table WHERE pk = 0". This API is using parameterized commands.
DeleteAsync(List<TEntity>, CancellationToken)
Asynchronously deletes the provided entities by their defined primary keys.
Declaration
public ValueTask<int> DeleteAsync(List<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
List<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<Int32> | A task representing the asynchronous operation, with the number of rows deleted. |
Remarks
This method represents the following SQL statement "DELETE FROM table WHERE pk = 0". This API is using parameterized commands.
DeleteAsync(IDeleteCommand<TEntity>, TEntity, CancellationToken)
Asynchronously deletes the provided entity by its defined primary key.
Declaration
public ValueTask<int> DeleteAsync(IDeleteCommand<TEntity> deleteCommand, TEntity entity, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IDeleteCommand<TEntity> | deleteCommand | A IDeleteCommand<TEntity> instance which contains all the settings for this operation. |
TEntity | entity | A |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<Int32> | A task representing the asynchronous operation, with the number of rows deleted. |
Remarks
This method represents the following SQL statement "DELETE FROM table WHERE pk = 0". This API is using parameterized commands.
DeleteAsync(IDeleteCommand<TEntity>, IEnumerable<TEntity>, CancellationToken)
Asynchronously deletes the provided entities by their defined primary keys.
Declaration
public ValueTask<int> DeleteAsync(IDeleteCommand<TEntity> deleteCommand, IEnumerable<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IDeleteCommand<TEntity> | deleteCommand | A IDeleteCommand<TEntity> instance which contains all the settings for this operation. |
IEnumerable<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<Int32> | A task representing the asynchronous operation, with the number of rows deleted. |
Remarks
This method represents the following SQL statement "DELETE FROM table WHERE pk = 0". This API is using parameterized commands.
GetProxiedEntity()
Constructs a new proxied instance of the TEntity
entity.
Declaration
public TEntity GetProxiedEntity()
Returns
Type | Description |
---|---|
TEntity | A |
Remarks
Any property which should be change tracked on an entity has to be marked virtual.
Insert()
Creates a new insert command.
Declaration
public IBaseInsertRelationBuilder<TEntity, TEntity> Insert()
Returns
Type | Description |
---|---|
IBaseInsertRelationBuilder<TEntity, TEntity> | A Fluent API Builder for a insert command. |
Remarks
The command will be automatically disposed the underlying
InsertAsync(TEntity, CancellationToken)
Asynchronously inserts the entity and all entities reachable from the current provided instance into the current table.
Declaration
public Task<int> InsertAsync(TEntity entity, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | A |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<Int32> | A task representing the asynchronous operation, with the number of rows inserted. |
Remarks
This method represents the following SQL statement "INSERT INTO table (foo, bar) VALUES ('foo', 'bar')". This API is using parameterized commands.
InsertAsync(IList<TEntity>, CancellationToken)
Asynchronously inserts a list of entities and all entities reachable from the current provided instances into the current table.
Declaration
public Task<int> InsertAsync(IList<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IList<TEntity> | entities | A list of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<Int32> | A task representing the asynchronous operation, with the number of rows inserted. |
Remarks
This method represents the following SQL statement "INSERT INTO table (foo, bar) VALUES ('foo', 'bar'), ('foo', 'bar')". This API is using parameterized commands.
InsertAsync(IInsertCommand<TEntity>, TEntity, CancellationToken)
Asynchronously inserts the entity and all entities reachable from the current provided instance into the current table.
Declaration
public Task<int> InsertAsync(IInsertCommand<TEntity> insertCommand, TEntity entity, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IInsertCommand<TEntity> | insertCommand | A IInsertCommand<TEntity> instance which contains all the settings for this operation. |
TEntity | entity | A |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<Int32> | A task representing the asynchronous operation, with the number of rows inserted. |
Remarks
This method represents the following SQL statement "INSERT INTO table (foo, bar) VALUES ('foo', 'bar')". This API is using parameterized commands.
InsertAsync(IInsertCommand<TEntity>, List<TEntity>, CancellationToken)
Asynchronously inserts a list of entities and all entities reachable from the current provided instances into the current table.
Declaration
public Task<int> InsertAsync(IInsertCommand<TEntity> insertCommand, List<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IInsertCommand<TEntity> | insertCommand | A IInsertCommand<TEntity> instance which contains all the settings for this operation. |
List<TEntity> | entities | A list of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<Int32> | A task representing the asynchronous operation, with the number of rows inserted. |
Remarks
This method represents the following SQL statement "INSERT INTO table (foo, bar) VALUES ('foo', 'bar'), ('foo', 'bar')". This API is using parameterized commands.
TrackChanges(ref TEntity)
Starts tracking the provided TEntity
.
Declaration
public void TrackChanges(ref TEntity entity)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | A |
Remarks
Any property which should be change tracked on an entity has to be marked virtual.
TrackChanges(IList<TEntity>)
Starts tracking the provided TEntity
's.
Declaration
public void TrackChanges(IList<TEntity> entities)
Parameters
Type | Name | Description |
---|---|---|
IList<TEntity> | entities | A set of |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.
TruncateAsync(ForeignTruncateOptions, CancellationToken)
Asynchronously truncates the current table with the provided options.
Declaration
public Task TruncateAsync(ForeignTruncateOptions foreignOptions, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ForeignTruncateOptions | foreignOptions | Specifies how the truncate operation should handle foreign tables. |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "TRUNCATE table [CASCADE|RESTRICT|NONE]".
TruncateAsync(IdentityTruncateOptions, ForeignTruncateOptions, CancellationToken)
Asynchronously truncates the current table with the provided options.
Declaration
public Task TruncateAsync(IdentityTruncateOptions truncateOptions = default(IdentityTruncateOptions), ForeignTruncateOptions foreignOptions = default(ForeignTruncateOptions), CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IdentityTruncateOptions | truncateOptions | Specifies how the truncate operation should handle identities in the table. |
ForeignTruncateOptions | foreignOptions | Specifies how the truncate operation should handle foreign tables. |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "TRUNCATE table [RESTART IDENTITY|CONTINUE IDENTITY|NONE] [CASCADE|RESTRICT|NONE]".
Update()
Creates a new update command.
Declaration
public IUpdateCommandBuilder<TEntity> Update()
Returns
Type | Description |
---|---|
IUpdateCommandBuilder<TEntity> | A Fluent API Builder for a update command. |
Update(Boolean)
Creates a new update command.
Declaration
public IUpdateCommandBuilder<TEntity> Update(bool disposeCommand)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposeCommand | Indicates whether or not to dispose the underlying |
Returns
Type | Description |
---|---|
IUpdateCommandBuilder<TEntity> | A Fluent API Builder for a update command. |
UpdateAsync(TEntity, CancellationToken)
Asynchronously updates the provided entity by its defined primary keys.
Declaration
public ValueTask UpdateAsync(TEntity entity, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | A |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.
UpdateAsync(TEntity[], CancellationToken)
Asynchronously updates the provided entity by its defined primary keys.
Declaration
public ValueTask UpdateAsync(TEntity[] entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TEntity[] | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.
UpdateAsync(IEnumerable<TEntity>, CancellationToken)
Asynchronously updates the provided entity by its defined primary keys.
Declaration
public ValueTask UpdateAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.
UpdateAsync(IList<TEntity>, CancellationToken)
Asynchronously updates the provided entity by its defined primary keys.
Declaration
public ValueTask UpdateAsync(IList<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IList<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.
UpdateAsync(List<TEntity>, CancellationToken)
Asynchronously updates the provided entity by its defined primary keys.
Declaration
public ValueTask UpdateAsync(List<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
List<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.
UpdateAsync(IUpdateCommand<TEntity>, TEntity, CancellationToken)
Asynchronously updates the provided entity by its defined primary keys.
Declaration
public ValueTask UpdateAsync(IUpdateCommand<TEntity> updateCommand, TEntity entity, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IUpdateCommand<TEntity> | updateCommand | A IUpdateCommand<TEntity> instance which contains all the settings for this operation. |
TEntity | entity | A |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.
UpdateAsync(IUpdateCommand<TEntity>, IEnumerable<TEntity>, CancellationToken)
Asynchronously updates the provided entity by its defined primary keys.
Declaration
public ValueTask UpdateAsync(IUpdateCommand<TEntity> updateCommand, IEnumerable<TEntity> entities, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IUpdateCommand<TEntity> | updateCommand | A IUpdateCommand<TEntity> instance which contains all the settings for this operation. |
IEnumerable<TEntity> | entities | A set of |
CancellationToken | cancellationToken | The cancellation token, which is used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | A task representing the asynchronous operation. |
Remarks
This method represents the following SQL statement "UPDATE table SET foo = 'foo' WHERE pk = 0". This API is using parameterized commands.