コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #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;
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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
            });
        }
コード例 #7
0
 private Task <IValueProvider> BindAsync(ServiceBusEntity value, ValueBindingContext context)
 {
     return(_argumentBinding.BindAsync(value, context));
 }
コード例 #8
0
 public MessageValueBinder(ServiceBusEntity entity, Guid functionInstanceId)
 {
     _entity             = entity;
     _functionInstanceId = functionInstanceId;
 }
コード例 #9
0
 private Task<IValueProvider> BindAsync(ServiceBusEntity value, ValueBindingContext context)
 {
     return _argumentBinding.BindAsync(value, context);
 }