コード例 #1
0
        public async Task <IProjectVoteData> GetAsync(string projectId, string user)
        {
            var partitionKey = ProjectVoteEntity.GeneratePartitionKey(projectId);
            var rowKey       = ProjectVoteEntity.GenerateRowKey(user);

            return(await _projectVoteTableStorage.GetDataAsync(partitionKey, rowKey));
        }
コード例 #2
0
        public async Task <IWinnerData> GetAsync(string projectId, string userId)
        {
            var partitionKey = WinnerEntity.GeneratePartitionKey(projectId);
            var rowKey       = WinnerEntity.GenerateRowKey(userId);

            return(await _winnersStorage.GetDataAsync(partitionKey, rowKey));
        }
コード例 #3
0
        public async Task <IProjectResultData> GetAsync(string projectId, string participantId)
        {
            var partitionKey = ProjectResultEntity.GeneratePartitionKey(projectId);
            var rowKey       = ProjectResultEntity.GenerateRowKey(participantId);

            return(await _projectResultInfoTableStorage.GetDataAsync(partitionKey, rowKey));
        }
コード例 #4
0
        public async Task <string> GetAsync()
        {
            var partitionKey = LastImportedBlockHashEntity.GeneratePartitionKey();
            var rowKey       = LastImportedBlockHashEntity.GenerateRowKey();

            var entity = await _tableStorage.GetDataAsync(partitionKey, rowKey);

            return(entity?.Hash);
        }
コード例 #5
0
        public async Task <IProjectData> GetAsync(string id)
        {
            var partitionKey = ProjectEntity.GeneratePartitionKey();
            var rowKey       = ProjectEntity.GenerateRowKey(id);

            var project = await _projectsTableStorage.GetDataAsync(partitionKey, rowKey);

            return(ChangeNullWithDefault(project));
        }
コード例 #6
0
        public async Task <IBitcoinBlock> GetAsync(string block)
        {
            var partitionKey = BicoinBlockEntity.GeneratePartiteonKey();
            var rowKey       = BicoinBlockEntity.GenerateRowKey(block);

            return(await _tableStorage.GetDataAsync(partitionKey, rowKey));
        }
コード例 #7
0
        /* public async Task UpdateIndexec()
         * {
         *   var partitionKey = TransactionEntity.GeneratePartiteonKey();
         *   var tableQuery =
         *       TableStorageUtils.QueryGenerator<TransactionEntity>.PartitionKeyOnly.GetTableQuery(partitionKey);
         *   await _tableStorage.ExecuteQueryAsync(tableQuery, chank =>
         *   {
         *       foreach (var items in chank.ToPieces(100))
         *       {
         *           var newEntits = items.Select(itm => AzureIndex.Create(IndexByBlockHash, itm.Blockhash, itm)).ToArray();
         *           _azureIndex.InsertOrReplaceBatchAsync(newEntits).Wait();
         *           Console.WriteLine("Add new"+ newEntits.Length + "items");
         *       }
         *   });
         * }*/



        public async Task <ITransaction> GetTransaction(string tx)
        {
            var rowKey       = TransactionEntity.GenerateRowKey(tx);
            var partitionKey = TransactionEntity.GeneratePartiteonKey();

            return(await _tableStorage.GetDataAsync(partitionKey, rowKey));
        }
コード例 #8
0
        public async Task <IUSerRoleData> GetAsync(string userId)
        {
            var partitionKey = UserRoleEntity.GeneratePartitionKey();
            var rowKey       = UserRoleEntity.GenerateRowKey(userId);

            return(await _userRoleTableStorage.GetDataAsync(partitionKey, rowKey));
        }
コード例 #9
0
        public async static Task <T> ReplaceAsync <T>(this IAzureTableStorage <AzureIndex> indexTableStorage, string indexPartitionKey,
                                                      string indexRowKey, IAzureTableStorage <T> tableStorage, Func <T, T> action) where T : class, ITableEntity, new()
        {
            var indexEntity = await indexTableStorage.GetDataAsync(indexPartitionKey, indexRowKey);

            return(await tableStorage.ReplaceAsync(indexEntity, action));
        }
コード例 #10
0
        public async Task <IAssets> GetAssetsDataAsync(string assetId)
        {
            var partiteonKey = AssetsEntity.GeneratePartiteonKey();
            var rowKey       = AssetsEntity.GenerateRowKey(assetId);
            var assetData    = await _tableStorage.GetDataAsync(partiteonKey, rowKey);

            return(assetData);
        }
コード例 #11
0
        public async static Task <T> GetDataAsync <T>(this IAzureTableStorage <T> tableStorage, IAzureIndex index) where T : class, ITableEntity, new()
        {
            if (index == null)
            {
                return(null);
            }

            return(await tableStorage.GetDataAsync(index.PrimaryPartitionKey, index.PrimaryRowKey));
        }
コード例 #12
0
        public async Task <IUser> AuthenticateAsync(string username, string password)
        {
            if (username == null || password == null)
            {
                return(null);
            }

            var partitionKey = UserEntity.GeneratePartitionKey();
            var rowKey       = UserEntity.GenerateRowKey(username);

            var entity = await _tableStorage.GetDataAsync(partitionKey, rowKey);

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

            return(entity.CheckPassword(password) ? entity : null);
        }
コード例 #13
0
        public static async Task <T> FindByIndex <T>(this IAzureTableStorage <AzureIndex> tableIndex,
                                                     IAzureTableStorage <T> tableStorage, string partitionKey, string rowKey) where T : class, ITableEntity, new()
        {
            var indexEntity = await tableIndex.GetDataAsync(partitionKey, rowKey);

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

            return(await tableStorage.GetDataAsync(indexEntity));
        }
コード例 #14
0
        public async Task <Asset> GetById(string id)
        {
            var rowKey       = BlockEntity.GenerateRowKey(id);
            var partitionKey = BlockEntity.GeneratePartiteonKey();

            var assetRecord = await _assetTable.GetDataAsync(partitionKey, rowKey);

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

            return((Asset)JsonConvert.DeserializeObject(assetRecord.JsonData));
        }
コード例 #15
0
        public static async Task <IEnumerable <T> > GetDataAsync <T>(this IAzureTableStorage <T> tableStorage,
                                                                     IEnumerable <IAzureIndex> indices, int pieces = 15, Func <T, bool> filter = null) where T : ITableEntity, new()
        {
            var idx = indices.ToArray();

            if (idx.Length == 0)
            {
                return(new T[0]);
            }

            var partitionKey = idx.First().PrimaryPartitionKey;
            var rowKeys      = idx.Select(itm => itm.PrimaryRowKey).ToArray();

            return(await tableStorage.GetDataAsync(partitionKey, rowKeys, pieces, filter));
        }
コード例 #16
0
        public async Task <IBlockNinja> GetBlockDataAsync(string blockId)
        {
            var rowKey       = BlockNinjaEntity.GenerateRowKey(blockId);
            var partiteonKey = BlockNinjaEntity.GeneratePartiteonKey();
            var block        = await _tableStorage.GetDataAsync(partiteonKey, rowKey);

            if (block == null)
            {
                return(null);
            }
            var blobBlockData = await _azureBlob.GetAsync(BlobContainer, block.BlobId);

            var jsonStr = Encoding.UTF8.GetString(blobBlockData.ToBytes());

            return(JsonConvert.DeserializeObject <DeserializeBlockNinja>(jsonStr));
        }
コード例 #17
0
        public async Task <Transaction> GetById(string id)
        {
            var rowKey       = TransactionEntity.GenerateRowKey(id);
            var partitionKey = TransactionEntity.GeneratePartiteonKey();

            var transactionRecord = await transactionStorage.GetDataAsync(partitionKey, rowKey);

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

            var block = JsonConvert.DeserializeObject <Transaction>(transactionRecord.JsonData);

            return(block);
        }
コード例 #18
0
        public async Task <IAssetsOwners> GetAssetsOwnersDataAsync(string assetId)
        {
            var rowKey       = AssetsOwnersEntity.GenerateRowKey(assetId);
            var partiteonKey = AssetsOwnersEntity.GeneratePartiteonKey();
            var assetData    = await _tableStorage.GetDataAsync(partiteonKey, rowKey);

            if (assetData == null)
            {
                return(null);
            }
            var blobAssetData = await _azureBlob.GetAsync(BlobContainer, assetData.BlobId);

            if (blobAssetData == null)
            {
                return(null);
            }
            var jsonStr = Encoding.UTF8.GetString(blobAssetData.ToBytes());

            return(JsonConvert.DeserializeObject <DeserializeAssetsOwner>(jsonStr));
        }
コード例 #19
0
        public async Task <Block> GetById(string id)
        {
            var rowKey       = BlockEntity.GenerateRowKey(id);
            var partitionKey = BlockEntity.GeneratePartiteonKey();

            var blockRecord = await _blockTable.GetDataAsync(partitionKey, rowKey);

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

            var blockJsonData = await _blobStorage.GetAsync(BlobContainer, blockRecord.Hash);

            var blockJson = Encoding.UTF8.GetString(blockJsonData.ToBytes());

            var block = JsonConvert.DeserializeObject <Block>(blockJson);

            _importedMap[id] = blockRecord.IsImported;

            return(block);
        }
コード例 #20
0
        public async Task <IEnumerable <ICommentData> > GetProjectCommentsAsync(string projectId)
        {
            var partitionKey = CommentEntity.GeneratePartitionKey(projectId);

            return(await _projectCommentsTableStorage.GetDataAsync(partitionKey));
        }
コード例 #21
0
        public async Task <IEnumerable <IMailSentData> > GetRegisterAsync(string userId)
        {
            var partitionKey = MailSentEntity.GeneratePartitionKey("Register");

            return(await _mailSentStorage.GetDataAsync(partitionKey));
        }
コード例 #22
0
        public async Task <IEnumerable <IOutput> > GetAsync(string hashBlock)
        {
            var partitionKey = OutputEntity.GeneratePartiteonKey(hashBlock);

            return(await _tableStorage.GetDataAsync(partitionKey));
        }
コード例 #23
0
 public async Task<IEnumerable<IProjectResultVoteData>> GetProjectResultVotesAsync(string projectId)
 {
     var partitionKey = ProjectResultVoteEntity.GeneratePartitionKey(projectId);
     return await _projectResultVoteTableStorage.GetDataAsync(partitionKey);
 }