Exemplo n.º 1
0
 public async Task DeleteAsync <TData>(IOperationExecutionInfo <TData> executionInfo) where TData : class
 {
     var entity = Convert(executionInfo);
     await _tableStorage.DeleteIfExistAsync(
         OperationExecutionInfoEntity.GeneratePartitionKey(entity.OperationName),
         OperationExecutionInfoEntity.GeneratePartitionKey(executionInfo.Id));
 }
Exemplo n.º 2
0
        public async Task <IOperationExecutionInfo <TData> > GetAsync <TData>(string operationName, string id)
            where TData : class
        {
            var obj = await _tableStorage.GetDataAsync(
                OperationExecutionInfoEntity.GeneratePartitionKey(operationName),
                OperationExecutionInfoEntity.GenerateRowKey(id)) ?? throw new InvalidOperationException(
                                $"Operation execution info for {operationName} #{id} not yet exists");

            return(Convert <TData>(obj));
        }
Exemplo n.º 3
0
        public async Task <IOperationExecutionInfo <TData> > GetOrAddAsync <TData>(string operationName, string operationId,
                                                                                   Func <IOperationExecutionInfo <TData> > factory) where TData : class
        {
            var entity = await _tableStorage.GetOrInsertAsync(
                OperationExecutionInfoEntity.GeneratePartitionKey(operationName),
                OperationExecutionInfoEntity.GeneratePartitionKey(operationId),
                () => Convert(factory()));

            return(Convert <TData>(entity));
        }