public AzureSearchAsyncCollector(AzureSearchIndexAttribute indexAttribute)
        {
            _indexAttribute = indexAttribute;

            _searchServiceClient = new SearchServiceClient(
                _indexAttribute.SearchServiceName,
                new SearchCredentials(_indexAttribute.SearchServiceKey));

            _indexClient = _searchServiceClient.Indexes.GetClient(_indexAttribute.IndexName);

            switch (_indexAttribute.IndexAction)
            {
            case IndexAction.MergeOrUpload:
                _indexAction = item => IndexBatch.MergeOrUpload(new[] { item });
                break;

            case IndexAction.Merge:
                _indexAction = item => IndexBatch.Merge(new[] { item });
                break;

            case IndexAction.Upload:
                _indexAction = item => IndexBatch.Upload(new[] { item });
                break;

            case IndexAction.Delete:
                _indexAction = item => IndexBatch.Delete(new[] { item });
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
 public IAsyncCollector <T> Convert(AzureSearchIndexAttribute attribute)
 {
     return(new AzureSearchAsyncCollector <T>(attribute));
 }