Ejemplo n.º 1
0
        public WebPubSubTriggerBinding(ParameterInfo parameterInfo, WebPubSubTriggerAttribute attribute, WebPubSubOptions options, IWebPubSubTriggerDispatcher dispatcher)
        {
            _parameterInfo = parameterInfo ?? throw new ArgumentNullException(nameof(parameterInfo));
            _attribute     = attribute ?? throw new ArgumentNullException(nameof(attribute));
            _dispatcher    = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
            _options       = options ?? throw new ArgumentNullException(nameof(options));

            BindingDataContract = CreateBindingContract(parameterInfo);
        }
        internal WebPubSubTriggerAttribute GetResolvedAttribute(WebPubSubTriggerAttribute attribute)
        {
            // Try resolve and throw exception if not able to find one.
            if (!_nameResolver.TryResolveWholeString(attribute.Hub, out var hub))
            {
                throw new ArgumentException($"Failed to resolve substitute configure: {attribute.Hub}, please add.");
            }
            if (!_nameResolver.TryResolveWholeString(attribute.EventName, out var eventName))
            {
                throw new ArgumentException($"Failed to resolve substitute configure: {attribute.EventName}, please add.");
            }

            return(new WebPubSubTriggerAttribute(
                       hub,
                       attribute.EventType,
                       eventName));
        }