Skip to content

Instantly share code, notes, and snippets.

@TimMurphy
Last active May 6, 2016 19:40
Show Gist options
  • Save TimMurphy/b49ca253445d6915087e35a2b1fe573f to your computer and use it in GitHub Desktop.
Save TimMurphy/b49ca253445d6915087e35a2b1fe573f to your computer and use it in GitHub Desktop.
Azure Table Storage
// WIP
public interface IAzureStorageTable<TEntity> where TEntity : ITableEntity
{
Task AddAsync(TEntity entity)
Task CreateIfNotExists()
Task DeleteAsync(TEntity entity)
Task UpdateAsync(TEntity entity)
Task<IEnumerable<TEntity>> GetAsync(string partitionKey)
Task<TEntity> GetAsync(string partitionKey, string rowKey)
Task<IEnumerable<TEntity>> FindAsync()
Task<IEnumerable<TEntity>> FindAsync(int rows, out string continuationKey)
}
public class AzureStorageTable<TEntity> : IAzureStorageTable<TEntity> where TEntity : ITableEntity
{
private readonly string _connectionString;
private readonly string _tableName;
public AzureStorageTable(string connectionString, string tableName)
{
_connectionString = connectionString;
_tableName = tableName
}
public Task AddAsync(TEntity entity)
{
var table = GetTable();
.....
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment