public CollectorValueProvider(ServiceBusEntity entity, object value, Type valueType)
        {
            if (value != null && !valueType.IsAssignableFrom(value.GetType()))
            {
                throw new InvalidOperationException("value is not of the correct type.");
            }

            _entity = entity;
            _value = value;
            _valueType = valueType;
        }
        public async Task<IValueProvider> BindAsync(BindingContext context)
        {
            context.CancellationToken.ThrowIfCancellationRequested();

            string boundQueueName = _path.Bind(context.BindingData);
            MessageSender messageSender = await _account.MessagingFactory.CreateMessageSenderAsync(boundQueueName);

            ServiceBusEntity entity = new ServiceBusEntity
            {
                Account = _account,
                MessageSender = messageSender,
                AccessRights = _accessRights
            };

            return await BindAsync(entity, context.ValueContext);
        }
Exemple #3
0
        public MessageSenderAsyncCollector(ServiceBusEntity entity, IConverter <T, BrokeredMessage> converter,
                                           Guid functionInstanceId)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

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

            _entity             = entity;
            _converter          = converter;
            _functionInstanceId = functionInstanceId;
        }
        public MessageSenderCollector(ServiceBusEntity entity, IConverter <T, Message> converter,
                                      Guid functionInstanceId)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (converter == null)
            {
                throw new ArgumentNullException(nameof(converter));
            }

            _entity             = entity;
            _converter          = converter;
            _functionInstanceId = functionInstanceId;
        }
        public async Task <IValueProvider> BindAsync(BindingContext context)
        {
            context.CancellationToken.ThrowIfCancellationRequested();

            string        boundQueueName = _path.Bind(context.BindingData);
            MessageSender messageSender  = await _account.MessagingFactory.CreateMessageSenderAsync(boundQueueName);

            ServiceBusEntity entity = new ServiceBusEntity
            {
                Account       = _account,
                MessageSender = messageSender,
                AccessRights  = _accessRights,
                EntityType    = _entityType
            };

            return(await BindAsync(entity, context.ValueContext));
        }
        public async Task <ConversionResult <ServiceBusEntity> > TryConvertAsync(object input,
                                                                                 CancellationToken cancellationToken)
        {
            TInput typedInput = input as TInput;

            if (typedInput == null)
            {
                return(new ConversionResult <ServiceBusEntity>
                {
                    Succeeded = false,
                    Result = null
                });
            }

            ServiceBusEntity entity = await _innerConverter.ConvertAsync(typedInput, cancellationToken).ConfigureAwait(false);

            return(new ConversionResult <ServiceBusEntity>
            {
                Succeeded = true,
                Result = entity
            });
        }
 private Task <IValueProvider> BindAsync(ServiceBusEntity value, ValueBindingContext context)
 {
     return(_argumentBinding.BindAsync(value, context));
 }
Exemple #8
0
 public MessageValueBinder(ServiceBusEntity entity, Guid functionInstanceId)
 {
     _entity             = entity;
     _functionInstanceId = functionInstanceId;
 }
 private Task<IValueProvider> BindAsync(ServiceBusEntity value, ValueBindingContext context)
 {
     return _argumentBinding.BindAsync(value, context);
 }