Beispiel #1
0
        void IExtensionConfigProvider.Initialize(ExtensionConfigContext context)
        {
            var rule = context.AddBindingRule <FakeQueueAttribute>();

            context.AddConverter <string, FakeQueueData>(x => new FakeQueueData {
                Message = x
            });
            context.AddConverter <FakeQueueData, string>(msg => msg.Message);
            context.AddConverter <OtherFakeQueueData, FakeQueueData>(OtherFakeQueueData.ToEvent);

            rule.AddOpenConverter <OpenType.Poco, FakeQueueData>(ConvertPocoToFakeQueueMessage);

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

            if (this.SetConverters != null)
            {
                this.SetConverters(context);
            }

            IExtensionRegistry extensions = context.Config.GetService <IExtensionRegistry>();

            // Binds [FakeQueue] --> IAsyncCollector<FakeQueueData>
            rule.BindToCollector <FakeQueueData>(BuildFromAttr);

            // Binds [FakeQueue] --> FakeQueueClient
            rule.BindToInput <FakeQueueClient>(this);

            var triggerBindingProvider = new FakeQueueTriggerBindingProvider(this, cm);

            extensions.RegisterExtension <ITriggerBindingProvider>(triggerBindingProvider);
        }
Beispiel #2
0
        void IExtensionConfigProvider.Initialize(ExtensionConfigContext context)
        {
            INameResolver     nameResolver = context.Config.GetService <INameResolver>();
            IConverterManager cm           = context.Config.GetService <IConverterManager>();

            cm.AddConverter <string, FakeQueueData>(x => new FakeQueueData {
                Message = x
            });

            if (this.SetConverters != null)
            {
                this.SetConverters(cm);
            }

            cm.AddConverter <FakeQueueData, string>(msg => msg.Message);
            cm.AddConverter <OtherFakeQueueData, FakeQueueData>(OtherFakeQueueData.ToEvent);

            IExtensionRegistry extensions = context.Config.GetService <IExtensionRegistry>();

            var bf = new BindingFactory(nameResolver, cm);

            // Binds [FakeQueue] --> IAsyncCollector<FakeQueueData>
            var ruleOutput = bf.BindToAsyncCollector <FakeQueueAttribute, FakeQueueData>(BuildFromAttr);

            // Binds [FakeQueue] --> FakeQueueClient
            var ruleClient = bf.BindToExactType <FakeQueueAttribute, FakeQueueClient>((attr) => this);

            extensions.RegisterBindingRules <FakeQueueAttribute>(ruleOutput, ruleClient);

            var triggerBindingProvider = new FakeQueueTriggerBindingProvider(this, cm);

            extensions.RegisterExtension <ITriggerBindingProvider>(triggerBindingProvider);
        }
Beispiel #3
0
        void IExtensionConfigProvider.Initialize(ExtensionConfigContext context)
        {
            var rule = context.AddBindingRule <FakeQueueAttribute>();

            context.AddConverter <string, FakeQueueData>(x => new FakeQueueData {
                Message = x
            });
            context.AddConverter <FakeQueueData, string>(msg => msg.Message);
            context.AddConverter <OtherFakeQueueData, FakeQueueData>(OtherFakeQueueData.ToEvent);

            rule.AddOpenConverter <OpenType.Poco, FakeQueueData>(ConvertPocoToFakeQueueMessage);

            SetConverters?.Invoke(context);

            // Binds [FakeQueue] --> IAsyncCollector<FakeQueueData>
            rule.BindToCollector <FakeQueueData>(BuildFromAttr);

            // Binds [FakeQueue] --> FakeQueueClient
            rule.BindToInput <FakeQueueClient>(this);

            var triggerBindingProvider = new FakeQueueTriggerBindingProvider(this, _converterManager);

            context.AddBindingRule <FakeQueueTriggerAttribute>()
            .BindToTrigger(triggerBindingProvider);
        }
Beispiel #4
0
            public void Initialize(ExtensionConfigContext context)
            {
                // Add [Test] support
                var rule = context.AddBindingRule <TestAttribute>();

                rule.BindToInput <string>(typeof(FakeExtClient), _nameResolver, _converterManager);

                // Add [FakeQueueTrigger] support.
                context.AddConverter <string, FakeQueueData>(x => new FakeQueueData {
                    Message = x
                });
                context.AddConverter <FakeQueueData, string>(msg => msg.Message);

                var triggerBindingProvider = new FakeQueueTriggerBindingProvider(new FakeQueueClient(_nameResolver, _converterManager), _converterManager);

                context.AddBindingRule <FakeQueueTriggerAttribute>().BindToTrigger(triggerBindingProvider);
            }
        void IExtensionConfigProvider.Initialize(ExtensionConfigContext context)
        {
            IConverterManager cm = context.Config.GetService <IConverterManager>();

            cm.AddConverter <string, FakeQueueData>(x => new FakeQueueData {
                Message = x
            });
            cm.AddConverter <FakeQueueData, string>(msg => msg.Message);
            cm.AddConverter <OtherFakeQueueData, FakeQueueData>(OtherFakeQueueData.ToEvent);

            IExtensionRegistry extensions = context.Config.GetService <IExtensionRegistry>();

            var bindingProvider = new FakeQueueBindingProvider(this, cm);

            extensions.RegisterExtension <IBindingProvider>(bindingProvider);

            var triggerBindingProvider = new FakeQueueTriggerBindingProvider(this, cm);

            extensions.RegisterExtension <ITriggerBindingProvider>(triggerBindingProvider);
        }
Beispiel #6
0
            public void Initialize(ExtensionConfigContext context)
            {
                IExtensionRegistry extensions = context.Config.GetService <IExtensionRegistry>();
                var bf = context.Config.BindingFactory;

                // Add [Test] support
                var rule = bf.BindToExactType <TestAttribute, string>(attr => attr.Path);

                extensions.RegisterBindingRules <TestAttribute>(rule);

                // Add [FakeQueueTrigger] support.
                IConverterManager cm = context.Config.GetService <IConverterManager>();

                cm.AddConverter <string, FakeQueueData>(x => new FakeQueueData {
                    Message = x
                });
                cm.AddConverter <FakeQueueData, string>(msg => msg.Message);
                var triggerBindingProvider = new FakeQueueTriggerBindingProvider(new FakeQueueClient(), cm);

                extensions.RegisterExtension <ITriggerBindingProvider>(triggerBindingProvider);
            }