示例#1
0
 public async Task Save(QueryModel queryModel)
 {
     queryModel.partitionKey = PartitionKeyGenerator.Generate(queryModel.id, _noOfPartitions);
     await DocumentDbRetryPolicy.ExecuteWithRetries(
         () => _client.UpsertDocumentAsync(GetCollectionUri(), queryModel, null, disableAutomaticIdGeneration: true)
         );
 }
示例#2
0
        public async Task DeleteById <T>(Guid aggregateId) where T : QueryModel
        {
            var options = CreateRequestOptions(aggregateId);

            await DocumentDbRetryPolicy.ExecuteWithRetries(
                async() => _client.DeleteDocumentAsync(await GetDocumentUri <T>(aggregateId), options)
                );
        }
示例#3
0
 public async Task <T> QueryItem <T>(Expression <Func <T, bool> > predicate) where T : QueryModel
 {
     return(await DocumentDbRetryPolicy.ExecuteWithRetries(
                () => QueryItemInternal <T>(predicate)
                ));
 }
示例#4
0
 public async Task Save(QueryModel queryModel)
 {
     await DocumentDbRetryPolicy.ExecuteWithRetries(
         () => _client.UpsertDocumentAsync(GetCollectionUri(), queryModel, null, disableAutomaticIdGeneration: true)
         );
 }
示例#5
0
 //TODO: Should this method be deleted?
 public async Task <bool> DoesItemExist <T>(Guid id) where T : QueryModel
 {
     return(await DocumentDbRetryPolicy.ExecuteWithRetries(
                () => DoesItemExistInternal <T>(id)
                ));
 }
示例#6
0
 public async Task <T> GetById <T>(Guid id) where T : QueryModel
 {
     return(await DocumentDbRetryPolicy.ExecuteWithRetries(
                () => GetByIdInternal <T>(id)
                ));
 }
示例#7
0
 public async Task <List <dynamic> > ExecuteRawSql(string sql)
 {
     return(await DocumentDbRetryPolicy.ExecuteWithRetries(
                () => ExecuteRawSqlInternal(sql)
                ));
 }
示例#8
0
 public async Task <int> QueryCountAsync <T>() where T : QueryModel
 {
     return(await DocumentDbRetryPolicy.ExecuteWithRetries(
                () => QueryCountAsyncInternal <T>()
                ));
 }
示例#9
0
 public async Task <PagedResult <T> > GetPagedListAsync <T>(PagedQuery pagedQuery, Expression <Func <T, bool> > predicate) where T : QueryModel
 {
     return(await DocumentDbRetryPolicy.ExecuteWithRetries(
                () => GetPagedListAsyncInternal <T>(pagedQuery, predicate)
                ));
 }
示例#10
0
 public async Task <List <T> > GetByIds <T>(List <Guid> ids) where T : QueryModel
 {
     return(await DocumentDbRetryPolicy.ExecuteWithRetries(
                () => GetByIdsInternal <T>(ids)
                ));
 }