コード例 #1
0
        public DispatcherSubscriptionsStore Subscribe()
        {
            var store = new DispatcherSubscriptionsStore();

            IEnumerable<TypeInfo> handlerTypes = _handlersProvider.GetHandlerTypes();
            IEnumerable<HandlerDescriptor> handlerDescriptors = _handlerDescriptorsBuilder.CreateHandlerDescriptors(handlerTypes);

            foreach (HandlerDescriptor handlerDescriptor in handlerDescriptors)
            {
                var actionDescriptors = _actionDescriptorsBuilder.CreateActionDescriptors(handlerDescriptor);
                foreach (ActionDescriptor actionDescriptor in actionDescriptors)
                {
                    store.Add(
                        new DispatcherSubscription(
                            handlerDescriptor.HandlerType,
                            actionDescriptor.HandlerAction,
                            actionDescriptor.MessageType,
                            actionDescriptor.Priority != DispatchingPriority.Unspecified ? actionDescriptor.Priority : handlerDescriptor.Priority)); //todo move to priority resolver
                }
            }

            return store;
        }