Interface ICloudStorageRepository<TEntity>
- Namespace
- CloudStorageORM.Interfaces.Repositories
- Assembly
- CloudStorageORM.dll
public interface ICloudStorageRepository<TEntity> where TEntity : class
Type Parameters
TEntity
Methods
AddAsync(string, TEntity)
Adds a new entity to storage for the provided identifier.
Task AddAsync(string id, TEntity entity)
Parameters
idstringEntity identifier used to build the storage path.
entityTEntityEntity instance to persist.
Returns
Examples
await repository.AddAsync("42", user);
FindAsync(string)
Finds an entity by identifier.
Task<TEntity> FindAsync(string id)
Parameters
idstringEntity identifier used to locate the storage object.
Returns
- Task<TEntity>
The matching entity when found.
Examples
var user = await repository.FindAsync("42");
ListAsync()
Lists all entities available for this repository type.
Task<List<TEntity>> ListAsync()
Returns
Examples
var users = await repository.ListAsync();
RemoveAsync(string)
Removes the entity identified by id from storage.
Task RemoveAsync(string id)
Parameters
idstringEntity identifier used to locate the storage object.
Returns
Examples
await repository.RemoveAsync("42");
UpdateAsync(string, TEntity)
Updates an existing entity in storage for the provided identifier.
Task UpdateAsync(string id, TEntity entity)
Parameters
idstringEntity identifier used to locate the storage object.
entityTEntityUpdated entity instance to persist.
Returns
Examples
await repository.UpdateAsync("42", user);