Interface IDbSet<TEntity>
Abstracts the DbSet functionality to allow for multiple and decoupled implementations.
Namespace: Silverback.Database
Assembly: Silverback.Core.dll
Syntax
public interface IDbSet<TEntity> where TEntity : class
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of the entity being stored in this set. |
Methods
| Improve this doc View sourceAdd(TEntity)
Adds the specified entity to the set and start tracking it. The entity will be inserted into the database when saving changes.
Declaration
TEntity Add(TEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| TEntity | entity | The entity to be added. |
Returns
| Type | Description |
|---|---|
| TEntity | The added entity. |
AsQueryable()
Returns an IQueryable to query the set.
Declaration
IQueryable<TEntity> AsQueryable()
Returns
| Type | Description |
|---|---|
| IQueryable<TEntity> | An IQueryable<T>. |
Find(params object[])
Finds the entity with the specified key(s). Returns null if not found.
Declaration
TEntity? Find(params object[] keyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | keyValues | The entity keys. |
Returns
| Type | Description |
|---|---|
| TEntity | The entity found, or |
FindAsync(params object[])
Finds the entity with the specified key(s). Returns null if not found.
Declaration
Task<TEntity?> FindAsync(params object[] keyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | keyValues | The entity keys. |
Returns
| Type | Description |
|---|---|
| Task<TEntity> | The entity found, or |
GetLocalCache()
Returns the locally cached entities.
Declaration
IEnumerable<TEntity> GetLocalCache()
Returns
| Type | Description |
|---|---|
| IEnumerable<TEntity> | The entities in the local cache. |
Remove(TEntity)
Removes the specified entity from the set causing it to be deleted when saving changes.
Declaration
TEntity Remove(TEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| TEntity | entity | The entity to be removed. |
Returns
| Type | Description |
|---|---|
| TEntity | The removed entity. |
RemoveRange(IEnumerable<TEntity>)
Removes the specified entities from the set causing them to be deleted when saving changes.
Declaration
void RemoveRange(IEnumerable<TEntity> entities)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TEntity> | entities | The entities to be removed. |