Interface IEntityManipulator
Provides CRUD database operations for entities.
Namespace: RentADeveloper.DbConnectionPlus.DatabaseAdapters
Assembly: RentADeveloper.DbConnectionPlus.dll
Syntax
public interface IEntityManipulator
Methods
View SourceDeleteEntitiesAsync<TEntity>(DbConnection, IEnumerable<TEntity>, DbTransaction?, CancellationToken)
Asynchronously deletes the specified entities, identified by their key property/properties, from the database.
Declaration
Task<int> DeleteEntitiesAsync<TEntity>(DbConnection connection, IEnumerable<TEntity> entities, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to delete the entities. |
| IEnumerable<TEntity> | entities | The entities to delete. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<int> | A task representing the asynchronous operation. Result will contain the number of rows affected by the delete operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entities to delete. |
Remarks
The table from which the entities will be deleted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| ArgumentException | No instance property of the type |
| DbUpdateConcurrencyException | A concurrency violation was encountered while deleting an entity. A concurrency violation occurs when an unexpected number of rows are affected by a delete operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |
DeleteEntities<TEntity>(DbConnection, IEnumerable<TEntity>, DbTransaction?, CancellationToken)
Deletes the specified entities, identified by their key property/properties, from the database.
Declaration
int DeleteEntities<TEntity>(DbConnection connection, IEnumerable<TEntity> entities, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to delete the entities. |
| IEnumerable<TEntity> | entities | The entities to delete. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| int | The number of rows affected by the delete operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entities to delete. |
Remarks
The table from which the entities will be deleted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| ArgumentException | No instance property of the type |
| DbUpdateConcurrencyException | A concurrency violation was encountered while deleting an entity. A concurrency violation occurs when an unexpected number of rows are affected by a delete operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |
DeleteEntityAsync<TEntity>(DbConnection, TEntity, DbTransaction?, CancellationToken)
Asynchronously deletes the specified entity, identified by its key property / properties, from the database.
Declaration
Task<int> DeleteEntityAsync<TEntity>(DbConnection connection, TEntity entity, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to delete the entity. |
| TEntity | entity | The entity to delete. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<int> | A task representing the asynchronous operation. Result will contain the number of rows affected by the delete operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entity to delete. |
Remarks
The table from which the entity will be deleted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| ArgumentException | No instance property of the type |
| DbUpdateConcurrencyException | A concurrency violation was encountered while deleting an entity. A concurrency violation occurs when an unexpected number of rows are affected by a delete operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |
DeleteEntity<TEntity>(DbConnection, TEntity, DbTransaction?, CancellationToken)
Deletes the specified entity, identified by its key property / properties, from the database.
Declaration
int DeleteEntity<TEntity>(DbConnection connection, TEntity entity, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to delete the entity. |
| TEntity | entity | The entity to delete. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| int | The number of rows affected by the delete operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entity to delete. |
Remarks
The table from which the entity will be deleted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| ArgumentException | No instance property of the type |
| DbUpdateConcurrencyException | A concurrency violation was encountered while deleting an entity. A concurrency violation occurs when an unexpected number of rows are affected by a delete operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |
InsertEntitiesAsync<TEntity>(DbConnection, IEnumerable<TEntity>, DbTransaction?, CancellationToken)
Asynchronously inserts the specified entities into the database.
Declaration
Task<int> InsertEntitiesAsync<TEntity>(DbConnection connection, IEnumerable<TEntity> entities, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to insert the entities. |
| IEnumerable<TEntity> | entities | The entities to insert. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<int> | A task representing the asynchronous operation. Result will contain the number of rows that were affected by the insert operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entities to insert. |
Remarks
The table into which the entities will be inserted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not inserted.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not inserted. Once an entity is inserted, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| OperationCanceledException | The operation was cancelled via |
InsertEntities<TEntity>(DbConnection, IEnumerable<TEntity>, DbTransaction?, CancellationToken)
Inserts the specified entities into the database.
Declaration
int InsertEntities<TEntity>(DbConnection connection, IEnumerable<TEntity> entities, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to insert the entities. |
| IEnumerable<TEntity> | entities | The entities to insert. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| int | The number of rows that were affected by the insert operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entities to insert. |
Remarks
The table into which the entities will be inserted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used
as the table name.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not inserted.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not inserted. Once an entity is inserted, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| OperationCanceledException | The operation was cancelled via |
InsertEntityAsync<TEntity>(DbConnection, TEntity, DbTransaction?, CancellationToken)
Asynchronously inserts the specified entity into the database.
Declaration
Task<int> InsertEntityAsync<TEntity>(DbConnection connection, TEntity entity, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to insert the entity. |
| TEntity | entity | The entity to insert. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<int> | A task representing the asynchronous operation. Result will contain the number of rows that were affected by the insert operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entity to insert. |
Remarks
The table into which the entity will be inserted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not inserted.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not inserted. Once an entity is inserted, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| OperationCanceledException | The operation was cancelled via |
InsertEntity<TEntity>(DbConnection, TEntity, DbTransaction?, CancellationToken)
Inserts the specified entity into the database.
Declaration
int InsertEntity<TEntity>(DbConnection connection, TEntity entity, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to insert the entity. |
| TEntity | entity | The entity to insert. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| int | The number of rows that were affected by the insert operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entity to insert. |
Remarks
The table into which the entity will be inserted can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not inserted.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not inserted. Once an entity is inserted, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| OperationCanceledException | The operation was cancelled via |
UpdateEntitiesAsync<TEntity>(DbConnection, IEnumerable<TEntity>, DbTransaction?, CancellationToken)
Asynchronously updates the specified entities, identified by their key property / properties, in the database.
Declaration
Task<int> UpdateEntitiesAsync<TEntity>(DbConnection connection, IEnumerable<TEntity> entities, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to update the entities. |
| IEnumerable<TEntity> | entities | The entities to update. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<int> | A task representing the asynchronous operation. Result will contain the number of rows that were affected by the update operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entities to update. |
Remarks
The table in which the entities will be updated can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not updated.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not updated. Once an entity is updated, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | No instance property (with a public getter) of the type |
| ArgumentNullException | |
| DbUpdateConcurrencyException | A concurrency violation was encountered while updating an entity. A concurrency violation occurs when an unexpected number of rows are affected by an update operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |
UpdateEntities<TEntity>(DbConnection, IEnumerable<TEntity>, DbTransaction?, CancellationToken)
Updates the specified entities, identified by their key property / properties, in the database.
Declaration
int UpdateEntities<TEntity>(DbConnection connection, IEnumerable<TEntity> entities, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to update the entities. |
| IEnumerable<TEntity> | entities | The entities to update. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| int | The number of rows that were affected by the update operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entities to update. |
Remarks
The table in which the entities will be updated can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not updated.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not updated. Once an entity is updated, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | No instance property of the type |
| ArgumentNullException | |
| DbUpdateConcurrencyException | A concurrency violation was encountered while updating an entity. A concurrency violation occurs when an unexpected number of rows are affected by an update operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |
UpdateEntityAsync<TEntity>(DbConnection, TEntity, DbTransaction?, CancellationToken)
Asynchronously updates the specified entity, identified by its key property / properties, in the database.
Declaration
Task<int> UpdateEntityAsync<TEntity>(DbConnection connection, TEntity entity, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to update the entity. |
| TEntity | entity | The entity to update. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<int> | A task representing the asynchronous operation. Result will contain the number of rows that were affected by the update operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entity to update. |
Remarks
The table in which the entity will be updated can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not updated.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not updated. Once an entity is updated, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| ArgumentException | No instance property of the type |
| DbUpdateConcurrencyException | A concurrency violation was encountered while updating an entity. A concurrency violation occurs when an unexpected number of rows are affected by an update operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |
UpdateEntity<TEntity>(DbConnection, TEntity, DbTransaction?, CancellationToken)
Updates the specified entity, identified by its key property / properties, in the database.
Declaration
int UpdateEntity<TEntity>(DbConnection connection, TEntity entity, DbTransaction? transaction, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| DbConnection | connection | The database connection to use to update the entity. |
| TEntity | entity | The entity to update. |
| DbTransaction | transaction | The database transaction within to perform the operation. |
| CancellationToken | cancellationToken | A token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| int | The number of rows that were affected by the update operation. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of entity to update. |
Remarks
The table in which the entity will be updated can be configured via TableAttribute or
Configure(Action<DbConnectionPlusConfiguration>). Per default, the singular name of the type
TEntity is used as the table name.
The type TEntity must have at least one instance property configured as key property.
Use KeyAttribute or Configure(Action<DbConnectionPlusConfiguration>) to configure key properties.
Per default, each instance property of the type TEntity is mapped to a column with the
same name (case-sensitive) in the table. This can be configured via ColumnAttribute or
Configure(Action<DbConnectionPlusConfiguration>).
The columns must have data types that are compatible with the property types of the corresponding properties. The compatibility is determined using RentADeveloper.DbConnectionPlus.Converters.ValueConverter.CanConvert(System.Type,System.Type).
Properties configured as ignored properties (via NotMappedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are not updated.
Properties configured as identity or computed properties (via DatabaseGeneratedAttribute or Configure(Action<DbConnectionPlusConfiguration>)) are also not updated. Once an entity is updated, the values for these properties are retrieved from the database and the entity properties are updated accordingly.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| ArgumentException | No instance property of the type |
| DbUpdateConcurrencyException | A concurrency violation was encountered while updating an entity. A concurrency violation occurs when an unexpected number of rows are affected by an update operation. This is usually because the data in the database has been modified since the entity has been loaded. |
| OperationCanceledException | The operation was cancelled via |