public async Task <IValueProvider> BindAsync(BindingContext context)
        {
            context.CancellationToken.ThrowIfCancellationRequested();

            string boundQueueName = _path.Bind(context.BindingData);
            var    messageSender  = _messagingProvider.CreateMessageSender(_clientFactory.CreateClientFromSetting(_attribute.Connection), boundQueueName);

            var entity = new ServiceBusEntity
            {
                MessageSender        = messageSender,
                ServiceBusEntityType = _attribute.ServiceBusEntityType,
            };

            return(await BindAsync(entity, context.ValueContext).ConfigureAwait(false));
        }
        public async Task <IValueProvider> BindAsync(BindingContext context)
        {
            context.CancellationToken.ThrowIfCancellationRequested();

            string boundQueueName = _path.Bind(context.BindingData);
            var    messageSender  = _messagingProvider.CreateMessageSender(boundQueueName, _account.ConnectionString);

            var entity = new ServiceBusEntity
            {
                MessageSender = messageSender,
                EntityType    = _entityType
            };

            return(await BindAsync(entity, context.ValueContext).ConfigureAwait(false));
        }
Esempio n. 3
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));
        }
Esempio n. 4
0
        public async Task <ServiceBusEntity> ConvertAsync(string input, CancellationToken cancellationToken)
        {
            string queueOrTopicName;

            // For convenience, treat an an empty string as a request for the default value.
            if (String.IsNullOrEmpty(input) && _defaultPath.IsBound)
            {
                queueOrTopicName = _defaultPath.Bind(null);
            }
            else
            {
                queueOrTopicName = input;
            }

            cancellationToken.ThrowIfCancellationRequested();
            MessageSender messageSender = await _account.MessagingFactory.CreateMessageSenderAsync(queueOrTopicName);

            return(new ServiceBusEntity
            {
                Account = _account,
                MessageSender = messageSender
            });
        }