Exemple #1
0
        protected ParameterDescriptor ParseBlobTrigger(BlobBindingMetadata trigger, Type triggerParameterType)
        {
            if (trigger == null)
            {
                throw new ArgumentNullException("trigger");
            }

            if (triggerParameterType == null)
            {
                throw new ArgumentNullException("triggerParameterType");
            }

            ConstructorInfo        ctorInfo         = typeof(BlobTriggerAttribute).GetConstructor(new Type[] { typeof(string) });
            string                 blobPath         = trigger.Path;
            CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder(ctorInfo, new object[] { blobPath });

            string parameterName = trigger.Name;
            var    attributes    = new Collection <CustomAttributeBuilder>
            {
                attributeBuilder
            };

            if (!string.IsNullOrEmpty(trigger.Connection))
            {
                FunctionBinding.AddStorageAccountAttribute(attributes, trigger.Connection);
            }

            return(new ParameterDescriptor(parameterName, triggerParameterType, attributes));
        }
        public BlobBinding(ScriptHostConfiguration config, BlobBindingMetadata metadata, FileAccess access) : base(config, metadata, access)
        {
            if (string.IsNullOrEmpty(metadata.Path))
            {
                throw new ArgumentException("The blob path cannot be null or empty.");
            }

            Path = metadata.Path;
            _pathBindingTemplate = BindingTemplate.FromString(Path);
        }
        public void GenerateBlobTriggerFunction()
        {
            BlobBindingMetadata trigger = new BlobBindingMetadata
            {
                Type = BindingType.BlobTrigger,
                Path = "foo/bar"
            };
            MethodInfo method = GenerateMethod(trigger);

            VerifyCommonProperties(method);

            // verify trigger parameter
            ParameterInfo parameter = method.GetParameters()[0];
            Assert.Equal("input", parameter.Name);
            Assert.Equal(typeof(string), parameter.ParameterType);
            BlobTriggerAttribute attribute = parameter.GetCustomAttribute<BlobTriggerAttribute>();
            Assert.Equal("foo/bar", attribute.BlobPath);
        }
Exemple #4
0
        protected ParameterDescriptor ParseBlobTrigger(BlobBindingMetadata trigger, Type triggerParameterType = null)
        {
            if (triggerParameterType == null)
            {
                triggerParameterType = typeof(string);
            }

            ConstructorInfo        ctorInfo         = typeof(BlobTriggerAttribute).GetConstructor(new Type[] { typeof(string) });
            string                 blobPath         = trigger.Path;
            CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder(ctorInfo, new object[] { blobPath });

            string parameterName = trigger.Name;
            var    attributes    = new Collection <CustomAttributeBuilder>
            {
                attributeBuilder
            };

            return(new ParameterDescriptor(parameterName, triggerParameterType, attributes));
        }
        protected ParameterDescriptor ParseBlobTrigger(BlobBindingMetadata trigger, Type triggerParameterType = null)
        {
            if (triggerParameterType == null)
            {
                triggerParameterType = typeof(string);
            }

            ConstructorInfo ctorInfo = typeof(BlobTriggerAttribute).GetConstructor(new Type[] { typeof(string) });
            string blobPath = trigger.Path;
            CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder(ctorInfo, new object[] { blobPath });

            string parameterName = trigger.Name;
            var attributes = new Collection<CustomAttributeBuilder>
            {
                attributeBuilder
            };
            return new ParameterDescriptor(parameterName, triggerParameterType, attributes);
        }
        protected ParameterDescriptor ParseBlobTrigger(BlobBindingMetadata trigger, Type triggerParameterType = null)
        {
            if (trigger == null)
            {
                throw new ArgumentNullException("trigger");
            }

            if (triggerParameterType == null)
            {
                triggerParameterType = typeof(string);
            }

            ConstructorInfo ctorInfo = typeof(BlobTriggerAttribute).GetConstructor(new Type[] { typeof(string) });
            string blobPath = trigger.Path;
            CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder(ctorInfo, new object[] { blobPath });

            string parameterName = trigger.Name;
            var attributes = new Collection<CustomAttributeBuilder>
            {
                attributeBuilder
            };

            if (!string.IsNullOrEmpty(trigger.Connection))
            {
                FunctionBinding.AddStorageAccountAttribute(attributes, trigger.Connection);
            }

            return new ParameterDescriptor(parameterName, triggerParameterType, attributes);
        }