Show / Hide Table of Contents

    Class DbSet<T>

    Represents the collection of all items that can be saved to the database, of a given type.

    Inheritance
    System.Object
    DbSet<T>
    Implements
    IDbSet<T>
    Namespace: Kros.KORM.Query
    Assembly: Kros.KORM.dll
    Syntax
    public class DbSet<T> : IDbSet<T>, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    The type that defines the set.

    Constructors

    DbSet(ICommandGenerator<T>, IQueryProvider, IQueryBase<T>, TableInfo)

    Initializes a new instance of the DbSet<T> class.

    Declaration
    public DbSet(ICommandGenerator<T> commandGenerator, IQueryProvider provider, IQueryBase<T> query, TableInfo tableInfo)
    Parameters
    Type Name Description
    ICommandGenerator<T> commandGenerator

    Generator to create commands.

    IQueryProvider provider

    Provider to executing commands.

    IQueryBase<T> query

    Query.

    TableInfo tableInfo

    Information about table from database.

    Properties

    AddedItems

    List of items in Added state.

    Declaration
    public IEnumerable<T> AddedItems { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<T>

    DeletedItems

    List of items in Deleted state.

    Declaration
    public IEnumerable<T> DeletedItems { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<T>

    EditedItems

    List of items in Edited state.

    Declaration
    public IEnumerable<T> EditedItems { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<T>

    Methods

    Add(T)

    Adds the item to the context underlying the set in the Added state such that it will be inserted into the database when CommitChanges is called.

    Declaration
    public void Add(T entity)
    Parameters
    Type Name Description
    T entity

    Item to add.

    Exceptions
    Type Condition
    AlreadyInCollectionException

    Adding item already exists in list of items.

    Add(IEnumerable<T>)

    Adds the items to the context underlying the set in the Added state such that it will be inserted into the database when CommitChanges is called.

    Declaration
    public void Add(IEnumerable<T> entities)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> entities

    The items to add.

    BulkInsert()

    Declaration
    public void BulkInsert()

    BulkInsert(IEnumerable<T>)

    Declaration
    public void BulkInsert(IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    BulkInsertAsync()

    Declaration
    public Task BulkInsertAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    BulkInsertAsync(IEnumerable<T>)

    Declaration
    public Task BulkInsertAsync(IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items
    Returns
    Type Description
    System.Threading.Tasks.Task

    BulkUpdate()

    Declaration
    public void BulkUpdate()

    BulkUpdate(Action<IDbConnection, IDbTransaction, String>)

    Declaration
    public void BulkUpdate(Action<IDbConnection, IDbTransaction, string> tempTableAction)
    Parameters
    Type Name Description
    System.Action<System.Data.IDbConnection, System.Data.IDbTransaction, System.String> tempTableAction

    BulkUpdate(IEnumerable<T>)

    Declaration
    public void BulkUpdate(IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    BulkUpdate(IEnumerable<T>, Action<IDbConnection, IDbTransaction, String>)

    Declaration
    public void BulkUpdate(IEnumerable<T> items, Action<IDbConnection, IDbTransaction, string> tempTableAction)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items
    System.Action<System.Data.IDbConnection, System.Data.IDbTransaction, System.String> tempTableAction

    BulkUpdateAsync()

    Declaration
    public Task BulkUpdateAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    BulkUpdateAsync(Action<IDbConnection, IDbTransaction, String>)

    Declaration
    public Task BulkUpdateAsync(Action<IDbConnection, IDbTransaction, string> tempTableAction)
    Parameters
    Type Name Description
    System.Action<System.Data.IDbConnection, System.Data.IDbTransaction, System.String> tempTableAction
    Returns
    Type Description
    System.Threading.Tasks.Task

    BulkUpdateAsync(IEnumerable<T>)

    Declaration
    public Task BulkUpdateAsync(IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items
    Returns
    Type Description
    System.Threading.Tasks.Task

    BulkUpdateAsync(IEnumerable<T>, Action<IDbConnection, IDbTransaction, String>)

    Declaration
    public Task BulkUpdateAsync(IEnumerable<T> items, Action<IDbConnection, IDbTransaction, string> tempTableAction)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items
    System.Action<System.Data.IDbConnection, System.Data.IDbTransaction, System.String> tempTableAction
    Returns
    Type Description
    System.Threading.Tasks.Task

    Clear()

    Clear Added, Edited and Deleted lists of items.

    Declaration
    public void Clear()

    CommitChanges()

    Commits all pending changes to the database.

    Declaration
    public void CommitChanges()

    CommitChangesAsync()

    Declaration
    public Task CommitChangesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    Delete(T)

    Adds the item to the context underlying the set in the Deleted state such that it will be deleted from the database when CommitChanges is called.

    Declaration
    public void Delete(T entity)
    Parameters
    Type Name Description
    T entity

    Item to add.

    Exceptions
    Type Condition
    AlreadyInCollectionException

    Adding item already exists in list of items.

    Delete(IEnumerable<T>)

    Marks the items as Deleted such that it will be deleted from the database when CommitChanges is called.

    Declaration
    public void Delete(IEnumerable<T> entities)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> entities

    The items to delete.

    Edit(T)

    Adds the item to the context underlying the set in the Edited state such that it will be updated in the database when CommitChanges is called.

    Declaration
    public void Edit(T entity)
    Parameters
    Type Name Description
    T entity

    Item to add.

    Exceptions
    Type Condition
    AlreadyInCollectionException

    Adding item already exists in list of items.

    Edit(IEnumerable<T>)

    Marks the items as Edited such that it will be updated in the database when CommitChanges is called.

    Declaration
    public void Edit(IEnumerable<T> entities)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> entities

    The items to edit.

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<T>

    An enumerator that can be used to iterate through the collection.

    Implements

    IDbSet<T>
    Back to top KROS a.s.