Beispiel #1
0
 private IAsyncCollector <FakeQueueData> BuildFromAttr(FakeQueueAttribute attr)
 {
     // Caller already resolved anything.
     return(new Myqueue
     {
         _parent = this,
         _prefix = attr.Prefix
     });
 }
Beispiel #2
0
        private object Builder(FakeQueueAttribute attrResolved, Type typeMessage)
        {
            var client = new FakeQueueTypedClient(this, attrResolved.Prefix);

            var t   = typeof(TypedAsyncCollector <>).MakeGenericType(typeMessage);
            var obj = Activator.CreateInstance(t, client);

            return(obj);
        }
Beispiel #3
0
            public string TemplateBind(PropertyInfo propInfo, Attribute attribute, BindingTemplate template, IReadOnlyDictionary <string, object> bindingData)
            {
                FakeQueueAttribute queueAttribute = (FakeQueueAttribute)attribute;

                if (propInfo.Name == nameof(CustomPolicy))
                {
                    queueAttribute.State1 += "value1";
                }

                if (propInfo.Name == nameof(ConstructorCustomPolicy))
                {
                    queueAttribute.State2 += "value2";
                }

                return(template.Bind(bindingData));
            }
        public Task <IBinding> TryCreateAsync(BindingProviderContext context)
        {
            ParameterInfo parameter = context.Parameter;

            FakeQueueAttribute attribute = parameter.GetCustomAttribute <FakeQueueAttribute>(inherit: false);

            if (attribute == null)
            {
                return(Task.FromResult <IBinding>(null));
            }

            string resolvedName = "fakequeue";
            Func <string, FakeQueueClient> invokeStringBinder = (invokeString) => _client;

            IBinding binding = BindingFactory.BindCollector <FakeQueueData, FakeQueueClient>(
                parameter,
                _converterManager,
                (client, valueBindingContext) => client,
                resolvedName,
                invokeStringBinder
                );

            return(Task.FromResult(binding));
        }
            public IAsyncCollector <T> Convert(FakeQueueAttribute attrResolved)
            {
                var client = new FakeQueueTypedClient(_client, attrResolved.Prefix);

                return(new TypedAsyncCollector <T>(client));
            }