DbConnectionPlus API Documentation
Search Results for

    Show / Hide Table of Contents

    Interface IEntityManipulator

    Provides CRUD database operations for entities.

    Namespace: RentADeveloper.DbConnectionPlus.DatabaseAdapters
    Assembly: RentADeveloper.DbConnectionPlus.dll
    Syntax
    public interface IEntityManipulator

    Methods

    View Source

    DeleteEntitiesAsync<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
    • connection is null.
    • entities is null.
    ArgumentException

    No instance property of the type TEntity is configured as a key property.

    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 cancellationToken.

    View Source

    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
    • connection is null.
    • entities is null.
    ArgumentException

    No instance property of the type TEntity is configured as a key property.

    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 cancellationToken.

    View Source

    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
    • connection is null.
    • entity is null.
    ArgumentException

    No instance property of the type TEntity is configured as a key property.

    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 cancellationToken.

    View Source

    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
    • connection is null.
    • entity is null.
    ArgumentException

    No instance property of the type TEntity is configured as a key property.

    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 cancellationToken.

    View Source

    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
    • connection is null.
    • entities is null.
    OperationCanceledException

    The operation was cancelled via cancellationToken.

    View Source

    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
    • connection is null.
    • entities is null.
    OperationCanceledException

    The operation was cancelled via cancellationToken.

    View Source

    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
    • connection is null.
    • entity is null.
    OperationCanceledException

    The operation was cancelled via cancellationToken.

    View Source

    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
    • connection is null.
    • entity is null.
    OperationCanceledException

    The operation was cancelled via cancellationToken.

    View Source

    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 TEntity is denoted with a KeyAttribute.

    ArgumentNullException
    • connection is null.
    • entities is null.
    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 cancellationToken.

    View Source

    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 TEntity is configured as a key property.

    ArgumentNullException
    • connection is null.
    • entities is null.
    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 cancellationToken.

    View Source

    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
    • connection is null.
    • entity is null.
    ArgumentException

    No instance property of the type TEntity is configured as a key property.

    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 cancellationToken.

    View Source

    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
    • connection is null.
    • entity is null.
    ArgumentException

    No instance property of the type TEntity is configured as a key property.

    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 cancellationToken.

    • View Source
    In this article
    Back to top Generated by DocFX