protected override async Task <IDataSinkAdapter> CreateAsync(DocumentDbClient client,
                                                                     IDataItemTransformation transformation, IDocumentDbBulkSinkAdapterConfiguration configuration)
        {
            var sink = new DocumentDbBulkSinkAdapter(client, transformation, GetInstanceConfiguration(configuration));
            await sink.InitializeAsync();

            return(sink);
        }
        public async Task InitializeAsync()
        {
            var initializationTasks = new List <Task>();
            var storedProcName      = BulkImportStoredProcPrefix + Guid.NewGuid().ToString("N");
            var collections         = Configuration.Collections.ToList();

            foreach (var collectionName in collections)
            {
                var adapter = new DocumentDbBulkSinkAdapter(Client, PassThroughTransformation.Instance,
                                                            CreateInstanceConfiguration(collectionName, storedProcName));
                dataAdapters.Add(collectionName, adapter);
                initializationTasks.Add(adapter.InitializeAsync());
            }

            partitionResolver = PartitionResolverFactory.Instance.Create(Configuration.PartitionKey, collections);

            await Task.WhenAll(initializationTasks);
        }