コード例 #1
0
        void IExtensionConfigProvider.Initialize(ExtensionConfigContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // Deferred list
            foreach (var action in _deferredWork)
            {
                action(context.Config);
            }
            _deferredWork.Clear();

            // get the services we need to construct our binding providers
            INameResolver      nameResolver = context.Config.NameResolver;
            IExtensionRegistry extensions   = context.Config.GetService <IExtensionRegistry>();

            IConverterManager cm = context.Config.GetService <IConverterManager>();

            cm.AddConverter <string, EventData>(ConvertString2EventData);
            cm.AddConverter <EventData, string>(ConvertEventData2String);
            cm.AddConverter <byte[], EventData>(ConvertBytes2EventData); // direct, handles non-string representations

            // register our trigger binding provider
            var triggerBindingProvider = new EventHubTriggerAttributeBindingProvider(nameResolver, cm, this);

            extensions.RegisterExtension <ITriggerBindingProvider>(triggerBindingProvider);

            // register our binding provider
            var bindingProvider = new EventHubAttributeBindingProvider(nameResolver, cm, this);

            extensions.RegisterExtension <IBindingProvider>(bindingProvider);
        }
コード例 #2
0
        void IExtensionConfigProvider.Initialize(ExtensionConfigContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // Deferred list 
            foreach (var action in _deferredWork)
            {
                action(context.Config);
            }
            _deferredWork.Clear();

            // get the services we need to construct our binding providers
            INameResolver nameResolver = context.Config.NameResolver;
            IExtensionRegistry extensions = context.Config.GetService<IExtensionRegistry>();

            IConverterManager cm = context.Config.GetService<IConverterManager>();
            cm.AddConverter<string, EventData>(ConvertString2EventData);
            cm.AddConverter<EventData, string>(ConvertEventData2String);
            cm.AddConverter<byte[], EventData>(ConvertBytes2EventData); // direct, handles non-string representations

            // register our trigger binding provider
            var triggerBindingProvider = new EventHubTriggerAttributeBindingProvider(nameResolver, cm, this);
            extensions.RegisterExtension<ITriggerBindingProvider>(triggerBindingProvider);

            // register our binding provider
            var bindingProvider = new EventHubAttributeBindingProvider(nameResolver, cm, this);
            extensions.RegisterExtension<IBindingProvider>(bindingProvider);
        }