public Task <IBinding> TryCreateAsync(BindingProviderContext context) { if (context == null) { throw new ArgumentNullException("context"); } ParameterInfo parameter = context.Parameter; EventHubAttribute attribute = parameter.GetCustomAttribute <EventHubAttribute>(inherit: false); if (attribute == null) { return(Task.FromResult <IBinding>(null)); } string name = attribute.EventHubName; var resolvedName = _nameResolver.ResolveWholeString(name); Func <string, EventHubClient> invokeStringBinder = (invokeString) => _eventHubConfig.GetEventHubClient(invokeString); IBinding binding = BindingFactory.BindCollector <EventData, EventHubClient>( parameter, _converterManager, (client, valueBindingContext) => new EventHubAsyncCollector(client), resolvedName, invokeStringBinder); return(Task.FromResult(binding)); }
private IAsyncCollector<EventData> BuildFromAttribute(EventHubAttribute attribute) { EventHubClient client = this.GetEventHubClient(attribute.EventHubName); return new EventHubAsyncCollector(client); }
private IAsyncCollector <EventData> BuildFromAttribute(EventHubAttribute attribute) { EventHubClient client = this.GetEventHubClient(attribute.EventHubName, attribute.Connection); return(new EventHubAsyncCollector(client)); }