Beispiel #1
0
        public override Task <DocumentServiceLease> CreateLeaseIfNotExistAsync(
            FeedRangeEpk feedRange,
            string continuationToken)
        {
            if (feedRange == null)
            {
                throw new ArgumentNullException(nameof(feedRange));
            }

            string leaseToken = $"{feedRange.Range.Min}-{feedRange.Range.Max}";
            DocumentServiceLeaseCoreEpk documentServiceLease = new DocumentServiceLeaseCoreEpk
            {
                LeaseId           = leaseToken,
                LeaseToken        = leaseToken,
                ContinuationToken = continuationToken,
                FeedRange         = feedRange
            };

            return(this.TryCreateDocumentServiceLeaseAsync(documentServiceLease));
        }
        public override Task <DocumentServiceLease> CreateLeaseIfNotExistAsync(
            FeedRangeEpk feedRange,
            string continuationToken)
        {
            if (feedRange == null)
            {
                throw new ArgumentNullException(nameof(feedRange));
            }

            string leaseToken = $"{feedRange.Range.Min}-{feedRange.Range.Max}";
            string leaseDocId = this.GetDocumentId(leaseToken);
            DocumentServiceLeaseCoreEpk documentServiceLease = new DocumentServiceLeaseCoreEpk
            {
                LeaseId           = leaseDocId,
                LeaseToken        = leaseToken,
                ContinuationToken = continuationToken,
                FeedRange         = feedRange
            };

            this.requestOptionsFactory.AddPartitionKeyIfNeeded((string pk) => documentServiceLease.LeasePartitionKey = pk, Guid.NewGuid().ToString());

            return(this.TryCreateDocumentServiceLeaseAsync(documentServiceLease));
        }