Example #1
0
        internal static DataEntity Create(Sha1 sha1, ArraySegment <byte> content)
        {
            if (sha1 == Sha1.Empty)
            {
                throw new ArgumentNullException(nameof(sha1));
            }

            var split = GetPartition(sha1);

            var entity = new DataEntity(split.Key, split.Value, content);

            return(entity);
        }
Example #2
0
        internal static TableOperation BuildDeleteOperation(Sha1 sha1)
        {
            var split = GetPartition(sha1);

            var entity = new DataEntity
            {
                PartitionKey = split.Key,
                RowKey       = split.Value,
                ETag         = "*" // No need to fetch the entity first
            };

            var op = TableOperation.Delete(entity);

            return(op);
        }
Example #3
0
        internal static DataEntity Create(string name, string branch, ArraySegment <byte> content, string etag)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (string.IsNullOrWhiteSpace(branch))
            {
                throw new ArgumentNullException(nameof(branch));
            }

            var partitionKey = GetPartitionKey(name);
            var rowKey       = GetRowKey(branch);

            var entity = new DataEntity(partitionKey, rowKey, content, etag);

            return(entity);
        }
Example #4
0
        internal static TableOperation BuildDeleteOperation(Sha1 sha1)
        {
            if (sha1 == Sha1.Empty)
            {
                throw new ArgumentNullException(nameof(sha1));
            }

            var split = GetPartition(sha1);

            var entity = new DataEntity
            {
                PartitionKey = split.Key,
                RowKey       = split.Value,
                ETag         = "*" // No need to fetch the entity first
            };

            var op = TableOperation.Delete(entity);

            return(op);
        }