Table of Contents

Class CloudStorageRepository<TEntity>

Namespace
CloudStorageORM.Repositories
Assembly
CloudStorageORM.dll

Repository wrapper that maps entity identifiers to provider-backed storage objects.

public class CloudStorageRepository<TEntity> : DbSet<TEntity>, IQueryable<TEntity>, IEnumerable<TEntity>, IQueryable, IEnumerable, IInfrastructure<IServiceProvider>, IListSource, ICloudStorageRepository<TEntity> where TEntity : class

Type Parameters

TEntity

Entity type managed by this repository.

Inheritance
DbSet<TEntity>
CloudStorageRepository<TEntity>
Implements
IQueryable<TEntity>
IEnumerable<TEntity>
Inherited Members
Extension Methods

Constructors

CloudStorageRepository(IStorageProvider)

Repository wrapper that maps entity identifiers to provider-backed storage objects.

public CloudStorageRepository(IStorageProvider storageProvider)

Parameters

storageProvider IStorageProvider

Properties

EntityType

Gets the EF metadata for the repository entity type.

public override IEntityType EntityType { get; }

Property Value

IEntityType

Exceptions

NotSupportedException

Always thrown because this repository does not expose custom EF metadata.

Methods

AddAsync(string, TEntity)

Adds a new entity to storage for the provided identifier.

public Task AddAsync(string id, TEntity entity)

Parameters

id string

Entity identifier used to build the storage path.

entity TEntity

Entity instance to persist.

Returns

Task

Examples

await repository.AddAsync("42", user);

FindAsync(string)

Finds an entity by identifier.

public Task<TEntity> FindAsync(string id)

Parameters

id string

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

public Task<List<TEntity>> ListAsync()

Returns

Task<List<TEntity>>

A list containing all stored entities.

Examples

var users = await repository.ListAsync();

RemoveAsync(string)

Removes the entity identified by id from storage.

public Task RemoveAsync(string id)

Parameters

id string

Entity identifier used to locate the storage object.

Returns

Task

Examples

await repository.RemoveAsync("42");

UpdateAsync(string, TEntity)

Updates an existing entity in storage for the provided identifier.

public Task UpdateAsync(string id, TEntity entity)

Parameters

id string

Entity identifier used to locate the storage object.

entity TEntity

Updated entity instance to persist.

Returns

Task

Examples

await repository.UpdateAsync("42", user);