コード例 #1
0
        public async Task UpdateAsync(IAssetPair assetPair)
        {
            await _assetPairRepository.UpsertAsync(assetPair);

            await _myNoSqlWriter.TryInsertOrReplaceAsync(AssetPairNoSql.Create(assetPair));

            //todo: remove cqrs
            _cqrsEngine.SendCommand(
                new UpdateAssetPairCommand {
                AssetPair = Mapper.Map <AssetPair>(assetPair)
            },
                BoundedContext.Name, BoundedContext.Name);
        }
        IAssetPair IAssetPairsClient.Get(string id)
        {
            try
            {
                var data = _readerAssetPairNoSql.Get(
                    AssetPairNoSql.GeneratePartitionKey(),
                    AssetPairNoSql.GenerateRowKey(id));

                return(data?.AssetPair);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Cannot read from MyNoSQL. Table: ${AssetPairNoSql.TableName}, PK: {AssetPairNoSql.GeneratePartitionKey()}, RK: {AssetPairNoSql.GenerateRowKey(id)}, Ex: {ex}");
                throw;
            }
        }
コード例 #3
0
        public async Task RemoveAsync(string id)
        {
            await _assetPairRepository.RemoveAsync(id);

            await _myNoSqlWriter.TryDeleteAsync(AssetPairNoSql.GeneratePartitionKey(), AssetPairNoSql.GenerateRowKey(id));
        }