Show / Hide Table of Contents

Class AzureTableRepository<TContext, TEntity>

Base class for AzureTable-backed repositories.

Inheritance
System.Object
AzureTableRepository<TContext, TEntity>
Implements
IAzureTableRepository<TEntity>
IRepository<Microsoft.Azure.Cosmos.Table.ITableEntity, TEntity>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Ease.Repository.AzureTable
Assembly: Ease.Repository.AzureTable.dll
Syntax
public abstract class AzureTableRepository<TContext, TEntity> : IAzureTableRepository<TEntity>, IRepository<ITableEntity, TEntity> where TContext : class, IAzureTableRepositoryContext where TEntity : class, ITableEntity, new()
Type Parameters
Name Description
TContext

The repository context Type this repository will operate on.

TEntity

The entity Type managed by the repository.

Constructors

| Improve this Doc View Source

AzureTableRepository(TContext)

Construct the repository instance to operate with the passed unitOfWork.

Declaration
protected AzureTableRepository(TContext context)
Parameters
Type Name Description
TContext context

Fields

| Improve this Doc View Source

Table

The Azure CloudTable in which the entities will be stored. Repositories can use this property to implement the read operations beyond the simple Get(ITableEntity) and List() methods.

Declaration
protected readonly Lazy<CloudTable> Table
Field Value
Type Description
System.Lazy<Microsoft.Azure.Cosmos.Table.CloudTable>

Properties

| Improve this Doc View Source

Context

The RepositoryContext.

Declaration
protected TContext Context { get; }
Property Value
Type Description
TContext
| Improve this Doc View Source

TableName

By default, TableName will be the typeof(TEntity).Name (which means the table name will change if you rename the entity class). If you wish to have a stable name, then override and return the desired name. Either way, the actual table name may include a prefix as governed by the TContext when it prepares the table.

Declaration
protected virtual string TableName { get; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

Add(TEntity)

Declaration
public virtual TEntity Add(TEntity entity)
Parameters
Type Name Description
TEntity entity
Returns
Type Description
TEntity
| Improve this Doc View Source

CalculatePartitionKeyFor(TEntity)

Override to return a suitable PartitionKey derived from the entity. This should be a function of the other properties in the entity so that a fundamental change to the partition can be detected and handled allowing for an entity to be moved properly (i.e. the entity's actual PartitionKey value should be treated as Read-Only).

Declaration
protected abstract string CalculatePartitionKeyFor(TEntity entity)
Parameters
Type Name Description
TEntity entity
Returns
Type Description
System.String
| Improve this Doc View Source

Delete(ITableEntity)

Declaration
public virtual void Delete(ITableEntity key)
Parameters
Type Name Description
Microsoft.Azure.Cosmos.Table.ITableEntity key
| Improve this Doc View Source

Get(ITableEntity)

Declaration
public virtual TEntity Get(ITableEntity key)
Parameters
Type Name Description
Microsoft.Azure.Cosmos.Table.ITableEntity key
Returns
Type Description
TEntity
| Improve this Doc View Source

List()

Declaration
public virtual IEnumerable<TEntity> List()
Returns
Type Description
System.Collections.Generic.IEnumerable<TEntity>
| Improve this Doc View Source

NewUniqueId()

Override to provide some other means of generating unique IDs. Default is using Guid.NewGuid() to reduce 3rd-party dependencies, but consider overriding and using a CombGuid algorithm or something similar. Do be sure this will generate a unique identifier within the scope of this TEntity's persistent store.

Declaration
protected virtual string NewUniqueId()
Returns
Type Description
System.String

Implements

IAzureTableRepository<TEntity>
IRepository<TKey, TEntity>

Extension Methods

ChangeTrackingExtensions.CurrentState<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX