Пример #1
0
        public async Task SaveRepositoryAsync(IRepository repository)
        {
            if (repository is RepositoryEntity rs)
            {
                rs.PartitionKey = RepositoryEntity.GeneratePartitionKey();
                rs.RowKey       = repository.RepositoryId;
            }
            else
            {
                var pk = RepositoryEntity.GeneratePartitionKey();
                var rk = RepositoryEntity.GenerateRowKey(repository.RepositoryId);

                rs = await _tableStorage.GetDataAsync(pk, rk)
                     ?? new RepositoryEntity
                {
                    PartitionKey = pk, RowKey = rk
                };

                rs.Name              = repository.Name;
                rs.GitUrl            = repository.GitUrl;
                rs.Branch            = repository.Branch;
                rs.FileName          = repository.FileName;
                rs.UserName          = repository.UserName;
                rs.ConnectionUrl     = repository.ConnectionUrl;
                rs.UseManualSettings = repository.UseManualSettings;
                rs.Tag = repository.Tag;
            }

            await _tableStorage.InsertOrMergeAsync(rs);
        }
Пример #2
0
        public async Task <IRepository> GetAsync(string repositoryId)
        {
            var pk = RepositoryEntity.GeneratePartitionKey();
            var rk = RepositoryEntity.GenerateRowKey(repositoryId);

            return(await _tableStorage.GetDataAsync(pk, rk));
        }