public WebHookReceiverManager(TraceWriter trace)
        {
            _trace = trace;
            _httpConfiguration = new HttpConfiguration();

            var builder = new ContainerBuilder();
            ILogger logger = new WebHookLogger(_trace);
            builder.RegisterInstance<ILogger>(logger);
            builder.RegisterInstance<IWebHookHandler>(new WebJobsWebHookHandler());
            var container = builder.Build();

            WebHooksConfig.Initialize(_httpConfiguration);

            _httpConfiguration.DependencyResolver = new AutofacWebApiDependencyResolver(container);

            IEnumerable<IWebHookReceiver> receivers = _httpConfiguration.DependencyResolver.GetReceivers();
            _receiverLookup = receivers.ToDictionary(p => p.Name, p => p, StringComparer.OrdinalIgnoreCase);
        }
Esempio n. 2
0
        public WebHookReceiverManager(TraceWriter trace)
        {
            _trace             = trace;
            _httpConfiguration = new HttpConfiguration();

            var     builder = new ContainerBuilder();
            ILogger logger  = new WebHookLogger(_trace);

            builder.RegisterInstance <ILogger>(logger);
            builder.RegisterInstance <IWebHookHandler>(new WebJobsWebHookHandler());
            var container = builder.Build();

            WebHooksConfig.Initialize(_httpConfiguration);

            _httpConfiguration.DependencyResolver = new AutofacWebApiDependencyResolver(container);

            IEnumerable <IWebHookReceiver> receivers = _httpConfiguration.DependencyResolver.GetReceivers();

            _receiverLookup = receivers.ToDictionary(p => p.Name, p => p, StringComparer.OrdinalIgnoreCase);
        }