Example #1
0
        public async Task InsertAsync(Position position)
        {
            var entity = new PositionEntity(GetPartitionKey(position.AssetPairId), GetRowKey(position.Id));

            Mapper.Map(position, entity);

            await _storage.InsertAsync(entity);
        }
        public async Task InsertAsync(Position position)
        {
            var entity = new PositionEntity(GetPartitionKey(position.Date), GetRowKey(position.Id));

            Mapper.Map(position, entity);

            await _storage.InsertAsync(entity);

            AzureIndex index = new AzureIndex(GetIndexPartitionKey(position.Id), GetIndexRowKey(position.Id), entity);

            await _indicesStorage.InsertAsync(index);
        }
        public async Task <Position> GetByIdAsync(string positionId)
        {
            AzureIndex index = await _indicesStorage.GetDataAsync(GetIndexPartitionKey(positionId),
                                                                  GetIndexRowKey(positionId));

            if (index == null)
            {
                return(null);
            }

            PositionEntity entity = await _storage.GetDataAsync(index);

            return(Mapper.Map <Position>(entity));
        }