Interface IRepository<TKey, TEntity>
Base interface for general entity repositories.
Namespace: Ease.Repository
Assembly: Ease.Repository.dll
Syntax
public interface IRepository<in TKey, TEntity>
where TEntity : TKey, new()
Type Parameters
| Name | Description |
|---|---|
| TKey | |
| TEntity |
Methods
| Improve this Doc View SourceAdd(TEntity)
Adds the entity to the repository. NOTE: Caller should proceed with the returned entity rather than the passed entity to guarantee proper unit of work tracking to be managed (i.e. the returned entity is not guaranteed to be reference equal to the passed entity).
Declaration
TEntity Add(TEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| TEntity | entity | The entity to create or update. |
Returns
| Type | Description |
|---|---|
| TEntity | The resultant repository-persistent entity. CAUTION: Do not attempt to serialize returned
repository entities. They are not guaranteed to be |
Delete(TKey)
Deletes an entity by its key. If the entity is already deleted, this does not generate an exception.
Declaration
void Delete(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key (may be compound) to use to find the entity to delete. |
Get(TKey)
Get an entity by its key.
Declaration
TEntity Get(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key (may be compound) to use to look up the entity. |
Returns
| Type | Description |
|---|---|
| TEntity | The matching entity, or |