1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

private member _table

This commit is contained in:
Kyle Spearrin 2017-12-08 23:14:02 -05:00
parent 89d488739d
commit 59fc1df754

View File

@ -11,6 +11,8 @@ namespace Bit.Core.Repositories.TableStorage
{
public class EventRepository : IEventRepository
{
private readonly CloudTable _table;
public EventRepository(GlobalSettings globalSettings)
: this(globalSettings.Storage.ConnectionString)
{ }
@ -19,11 +21,9 @@ namespace Bit.Core.Repositories.TableStorage
{
var storageAccount = CloudStorageAccount.Parse(storageConnectionString);
var tableClient = storageAccount.CreateCloudTableClient();
Table = tableClient.GetTableReference("event");
_table = tableClient.GetTableReference("event");
}
protected CloudTable Table { get; set; }
public async Task<ICollection<IEvent>> GetManyByUserAsync(Guid userId,
DateTime startDate, DateTime endDate)
{
@ -45,7 +45,7 @@ namespace Bit.Core.Repositories.TableStorage
TableContinuationToken continuationToken = null;
do
{
var queryResults = await Table.ExecuteQuerySegmentedAsync(query, continuationToken);
var queryResults = await _table.ExecuteQuerySegmentedAsync(query, continuationToken);
continuationToken = queryResults.ContinuationToken;
results.AddRange(queryResults.Results);
} while(continuationToken != null);
@ -103,14 +103,14 @@ namespace Bit.Core.Repositories.TableStorage
batch.InsertOrReplace(entity);
}
await Table.ExecuteBatchAsync(batch);
await _table.ExecuteBatchAsync(batch);
}
}
}
public async Task CreateEntityAsync(ITableEntity entity)
{
await Table.ExecuteAsync(TableOperation.Insert(entity));
await _table.ExecuteAsync(TableOperation.Insert(entity));
}
}
}