Exemplo n.º 1
0
        public Task WriteAsync(IDataItem dataItem, CancellationToken cancellation)
        {
            if (String.IsNullOrEmpty(collectionLink))
            {
                throw Errors.SinkIsNotInitialized();
            }

            dataItem = Transformation.Transform(dataItem);

            var dataItemSurrogate = new DataItemSurrogate(dataItem);

            return(Configuration.UpdateExisting
                ? Client.UpsertDocumentAsync(collectionLink, dataItemSurrogate, Configuration.DisableIdGeneration)
                : Client.CreateDocumentAsync(collectionLink, dataItemSurrogate, Configuration.DisableIdGeneration));
        }
Exemplo n.º 2
0
        public Task WriteAsync(IDataItem dataItem, CancellationToken cancellation)
        {
            if (partitionResolver == null)
            {
                throw Errors.SinkIsNotInitialized();
            }

            dataItem = Transformation.Transform(dataItem);
            var partitionKey = partitionResolver.GetPartitionKey(dataItem);

            var collectionLink    = partitionResolver.ResolveForCreate(partitionKey);
            var dataItemSurrogate = new DataItemSurrogate(dataItem);

            return(Configuration.UpdateExisting
                ? Client.UpsertDocumentAsync(collectionLink, dataItemSurrogate, Configuration.DisableIdGeneration)
                : Client.CreateDocumentAsync(collectionLink, dataItemSurrogate, Configuration.DisableIdGeneration));
        }
Exemplo n.º 3
0
 public BulkItemSurrogate(int documentIndex, IDataItem document)
 {
     DocumentIndex = documentIndex;
     Document      = new DataItemSurrogate(document);
 }
 public BulkItemSurrogate(int documentIndex, IDataItem document)
 {
     DocumentIndex = documentIndex;
     Document = new DataItemSurrogate(document);
 }