public Type GetDefaultType()

in src/Microsoft.Azure.WebJobs.Host/Extensions/JobHostMetadataProvider.cs [223:271]


        public Type GetDefaultType(
            Attribute attribute,
            FileAccess access, // direction In, Out, In/Out
            Type requestedType) // combination of Cardinality and DataType.
        {
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }
            if (requestedType == null)
            {
                requestedType = typeof(object);
            }
            var providers = this._root;

            IBindingRuleProvider root = (IBindingRuleProvider)providers;
            var type = root.GetDefaultType(attribute, access, requestedType);

            if (type == null)
            {
                if (access == FileAccess.Read)
                {
                    // For input bindings, if we have a specific requested type, then return and try to bind against that. 
                    // ITriggerBindingProvider doesn't provide rules.
                    if (requestedType != typeof(object))
                    {
                        return requestedType;
                    }
                    else
                    {
                        // common default. If binder doesn't support this, it will fail later in the pipeline. 
                        return typeof(String);
                    }
                }

                // IBindingProvider does not provide rules. Attempt to use IAsyncCollector<string>.
                if (access == FileAccess.Write)
                {
                    return typeof(IAsyncCollector<string>);
                }
            }

            if (type == null)
            {
                throw new InvalidOperationException($"Can't bind {attribute.GetType().Name} to a script-compatible type for {access} access" +
                    ((requestedType != null) ? $" to { requestedType.Name }." : "."));
            }
            return type;
        }