public RedisEntity(RedisAccount account, BindingTemplate channelOrKeyPath, Mode mode, IReadOnlyDictionary<string, object> bindingData)
 {
     Account = account;
     Mode = mode;
     _channelOrKeyPath = channelOrKeyPath;
     _bindingData = bindingData;
 }
 public FileBinding(FilesConfiguration config, ParameterInfo parameter, BindingTemplate bindingTemplate)
 {
     _config = config;
     _parameter = parameter;
     _bindingTemplate = bindingTemplate;
     _attribute = _parameter.GetCustomAttribute<FileAttribute>(inherit: false);
 }
        public ParameterizedServiceBusPath(BindingTemplate template)
        {
            Debug.Assert(template != null, "template must not be null");
            Debug.Assert(template.ParameterNames.Count() > 0, "template must contain one or more parameters");

            _template = template;
        }
        public SlackBinding(ParameterInfo parameter, SlackAttribute attribute, SlackConfiguration config, INameResolver nameResolver, BindingProviderContext context)
        {
            _parameter = parameter;
            _attribute = attribute;
            _config = config;
            _nameResolver = nameResolver;
            
            if(!string.IsNullOrEmpty(_attribute.WebHookUrl))
            {
                _webHookUrlBindingTemplate = CreateBindingTemplate(_attribute.WebHookUrl, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Text))
            {
                _textBindingTemplate = CreateBindingTemplate(_attribute.Text, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Username))
            {
                _usernameBindingTemplate = CreateBindingTemplate(_attribute.Username, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.IconEmoji))
            {
                _iconEmojiBindingTemplate = CreateBindingTemplate(_attribute.IconEmoji, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Channel))
            {
                _channelBindingTemplate = CreateBindingTemplate(_attribute.Channel, context.BindingDataContract);
            }
        }
        public SendGridBinding(ParameterInfo parameter, SendGridAttribute attribute, SendGridConfiguration config, INameResolver nameResolver, BindingProviderContext context)
        {
            _parameter = parameter;
            _attribute = attribute;
            _config = config;
            _nameResolver = nameResolver;

            _sendGrid = new Web(_config.ApiKey);

            if (!string.IsNullOrEmpty(_attribute.To))
            {
                _toFieldBindingTemplate = CreateBindingTemplate(_attribute.To, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.From))
            {
                _fromFieldBindingTemplate = CreateBindingTemplate(_attribute.From, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Subject))
            {
                _subjectFieldBindingTemplate = CreateBindingTemplate(_attribute.Subject, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Text))
            {
                _textFieldBindingTemplate = CreateBindingTemplate(_attribute.Text, context.BindingDataContract);
            }
        }
        public TableBinding(ScriptHostConfiguration config, TableBindingMetadata metadata, FileAccess access) 
            : base(config, metadata, access)
        {
            if (string.IsNullOrEmpty(metadata.TableName))
            {
                throw new ArgumentException("The table name cannot be null or empty.");
            }

            TableName = metadata.TableName;

            PartitionKey = metadata.PartitionKey;
            if (!string.IsNullOrEmpty(PartitionKey))
            {
                _partitionKeyBindingTemplate = BindingTemplate.FromString(PartitionKey);
            }

            RowKey = metadata.RowKey;
            if (!string.IsNullOrEmpty(RowKey))
            {
                _rowKeyBindingTemplate = BindingTemplate.FromString(RowKey);
            }

            _tableQuery = new TableQuery
            {
                TakeCount = metadata.Take ?? 50,
                FilterString = metadata.Filter
            };
        }
        public ParameterizedBlobPath(BindingTemplate containerNameTemplate, BindingTemplate blobNameTemplate)
        {
            Debug.Assert(containerNameTemplate != null);
            Debug.Assert(blobNameTemplate != null);

            _containerNameTemplate = containerNameTemplate;
            _blobNameTemplate = blobNameTemplate;
        }
        public ParameterizedTableEntityPath(BindingTemplate tableNameTemplate, BindingTemplate partitionKeyTemplate, 
            BindingTemplate rowKeyTemplate)
        {
            Debug.Assert(tableNameTemplate.ParameterNames.Count() > 0 || partitionKeyTemplate.ParameterNames.Count() > 0
                || rowKeyTemplate.ParameterNames.Count() > 0);

            _tableNameTemplate = tableNameTemplate;
            _partitionKeyTemplate = partitionKeyTemplate;
            _rowKeyTemplate = rowKeyTemplate;
        }
        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 QueueBinding(ScriptHostConfiguration config, QueueBindingMetadata metadata, FileAccess access) : 
            base(config, metadata, access)
        {
            if (string.IsNullOrEmpty(metadata.QueueName))
            {
                throw new ArgumentException("The queue name cannot be null or empty.");
            }

            QueueName = metadata.QueueName;
            _queueNameBindingTemplate = BindingTemplate.FromString(QueueName);
        }
        public EventHubBinding(ScriptHostConfiguration config, EventHubBindingMetadata metadata, FileAccess access) : 
            base(config, metadata, access)
        {
            if (string.IsNullOrEmpty(metadata.Path))
            {
                throw new ArgumentException("The event hub path cannot be null or empty.");
            }

            EventHubName = metadata.Path;
            _eventHubNameBindingTemplate = BindingTemplate.FromString(EventHubName);
        }
        public RedisBinding(string parameterName, IArgumentBinding<RedisEntity> argumentBinding,
            RedisAccount account, RedisAttribute attribute, BindingProviderContext context, TraceWriter trace)
        {
            _parameterName = parameterName;
            _argumentBinding = argumentBinding;
            _account = account;
            _attribute = attribute;
            _mode = attribute.Mode;

            _channelOrKeyPath = BindingTemplate.FromString(attribute.ChannelOrKey);
            _trace = trace;
        }
        public ServiceBusBinding(ScriptHostConfiguration config, ServiceBusBindingMetadata metadata, FileAccess access) : 
            base(config, metadata, access)
        {
            string queueOrTopicName = metadata.QueueName ?? metadata.TopicName;
            if (string.IsNullOrEmpty(queueOrTopicName))
            {
                throw new ArgumentException("A valid queue or topic name must be specified.");
            }

            QueueOrTopicName = queueOrTopicName;
            _queueOrTopicNameBindingTemplate = BindingTemplate.FromString(QueueOrTopicName);
        }
Exemplo n.º 14
0
        private static bool IsValidIdentifier(string identifier)
        {
            // built-in sysetem identifiers are valid
            if (BindingTemplate.IsSystemBindingParameter(identifier))
            {
                return(true);
            }

            // match against our identifier regex
            // note that system identifiers include a '-' character so wouldn't
            // pass this test
            return(Regex.IsMatch(identifier, IdentifierPattern));
        }
        public ApiHubBinding(ScriptHostConfiguration config, ApiHubBindingMetadata apiHubBindingMetadata, FileAccess access) : base(config, apiHubBindingMetadata, access)
        {
            if (apiHubBindingMetadata == null)
            {
                throw new ArgumentNullException("apiHubBindingMetadata");
            }

            if (string.IsNullOrEmpty(apiHubBindingMetadata.Path))
            {
                throw new ArgumentException("The ApiHub path cannot be null or empty.");
            }

            Key = apiHubBindingMetadata.Key;
            Path = apiHubBindingMetadata.Path;
            _pathBindingTemplate = BindingTemplate.FromString(Path);
        }
        public TableBinding(ScriptHostConfiguration config, string name, string tableName, string partitionKey, string rowKey, FileAccess fileAccess, TableQuery tableQuery = null) : base(config, name, "queue", fileAccess, false)
        {
            TableName = tableName;
            PartitionKey = partitionKey;
            RowKey = rowKey;
            _partitionKeyBindingTemplate = BindingTemplate.FromString(PartitionKey);
            if (!string.IsNullOrEmpty(RowKey))
            {
                _rowKeyBindingTemplate = BindingTemplate.FromString(RowKey);
            }

            _tableQuery = tableQuery;
            if (_tableQuery == null)
            {
                _tableQuery = new TableQuery
                {
                    TakeCount = 50
                };
            }
        }
 public QueueBinding(ScriptHostConfiguration config, string name, string queueName, FileAccess fileAccess, bool isTrigger) : base(config, name, "queue", fileAccess, isTrigger)
 {   
     QueueName = queueName;
     _queueNameBindingTemplate = BindingTemplate.FromString(QueueName);
 }
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="pattern"></param>
 public BindablePath(string pattern)
 {
     _bindingTemplate = BindingTemplate.FromString(pattern);
 }
 public BlobBinding(string name, string path, FileAccess fileAccess, bool isTrigger) : base(name, "blob", fileAccess, isTrigger)
 {
     Path = path;
     _pathBindingTemplate = BindingTemplate.FromString(Path);
 }
 public QueueBinding(string name, string queueName, FileAccess fileAccess, bool isTrigger) : base(name, "queue", fileAccess, isTrigger)
 {   
     QueueName = queueName;
     _queueNameBindingTemplate = BindingTemplate.FromString(QueueName);
 }
 public ServiceBusBinding(ScriptHostConfiguration config, string name, string queueOrTopicName, FileAccess fileAccess, bool isTrigger) : base(config, name, "serviceBus", fileAccess, isTrigger)
 {
     QueueOrTopicName = queueOrTopicName;
     _queueOrTopicNameBindingTemplate = BindingTemplate.FromString(QueueOrTopicName);
 }
        public ParameterizedTablePath(BindingTemplate template)
        {
            Debug.Assert(template.ParameterNames.Count() > 0);

            _template = template;
        }
 public BlobBinding(ScriptHostConfiguration config, string name, string path, FileAccess fileAccess, bool isTrigger) : base(config, name, "blob", fileAccess, isTrigger)
 {
     Path = path;
     _pathBindingTemplate = BindingTemplate.FromString(Path);
 }