public Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            ParameterInfo parameter = context.Parameter;

            RethinkDbTriggerAttribute triggerAttribute = parameter.GetCustomAttribute <RethinkDbTriggerAttribute>(inherit: false);

            if (triggerAttribute is null)
            {
                return(_nullTriggerBindingTask);
            }

            ConnectionOptions  triggerConnectionOptions = ResolveTriggerConnectionOptions(triggerAttribute);
            Task <IConnection> triggerConnectionTask    = _rethinkDBConnectionFactory.GetConnectionAsync(triggerConnectionOptions);

            TableOptions triggerTableOptions = ResolveTriggerTableOptions(triggerAttribute);

            return(Task.FromResult <ITriggerBinding>(new RethinkDbTriggerBinding(parameter, triggerConnectionTask, triggerTableOptions, triggerAttribute.IncludeTypes)));
        }
        public IAsyncCollector <T> Convert(RethinkDbAttribute attribute)
        {
            ConnectionOptions connectionOptions = ConnectionOptionsBuilder.Build(attribute, _options);

            return(new RethinkDbAsyncCollector <T>(attribute, _rethinkDBConnectionFactory.GetConnectionAsync(connectionOptions)));
        }
        private Task <IValueBinder> CreateValueBinderAsync(RethinkDbAttribute attribute, Type type)
        {
            if (String.IsNullOrEmpty(attribute.Id))
            {
                throw new InvalidOperationException($"The '{nameof(RethinkDbAttribute.Id)}' property of a RethinkDB single-item input binding cannot be null or empty.");
            }

            ConnectionOptions connectionOptions = ConnectionOptionsBuilder.Build(attribute, _options);
            Type         valyeBinderType        = typeof(RethinkDbValueBinder <>).MakeGenericType(type);
            IValueBinder valueBinder            = (IValueBinder)Activator.CreateInstance(valyeBinderType, attribute, _rethinkDBConnectionFactory.GetConnectionAsync(connectionOptions));

            return(Task.FromResult(valueBinder));
        }