Beispiel #1
0
        public List <Frame> DetermineFrames()
        {
            if (!Handlers.Any())
            {
                throw new InvalidOperationException("No method handlers configured for message type " + MessageType.FullName);
            }

            applyAttributesAndConfigureMethods();

            foreach (var attribute in MessageType.GetTypeInfo().GetCustomAttributes(typeof(ModifyHandlerChainAttribute)).OfType <ModifyHandlerChainAttribute>())
            {
                attribute.Modify(this);
            }

            foreach (var attribute in MessageType.GetTypeInfo().GetCustomAttributes(typeof(ModifyChainAttribute)).OfType <ModifyChainAttribute>())
            {
                attribute.Modify(this);
            }

            var i = 0;
            var cascadingHandlers = Handlers.Where(x => x.ReturnVariable != null)
                                    .Select(x => new CaptureCascadingMessages(x.ReturnVariable, ++i));

            return(Middleware.Concat(Handlers).Concat(cascadingHandlers).ToList());
        }
Beispiel #2
0
        /// <summary>
        /// Used internally to create the initial list of ordered Frames
        /// that will be used to generate the MessageHandler
        /// </summary>
        /// <param name="rules"></param>
        /// <param name="container"></param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public List <Frame> DetermineFrames(GenerationRules rules, IContainer container)
        {
            if (!Handlers.Any())
            {
                throw new InvalidOperationException("No method handlers configured for message type " +
                                                    MessageType.FullName);
            }

            if (!hasConfiguredFrames)
            {
                hasConfiguredFrames = true;

                applyAttributesAndConfigureMethods(rules, container);

                foreach (var attribute in MessageType.GetTypeInfo()
                         .GetCustomAttributes(typeof(ModifyHandlerChainAttribute))
                         .OfType <ModifyHandlerChainAttribute>())
                {
                    attribute.Modify(this, rules);
                }

                foreach (var attribute in MessageType.GetTypeInfo().GetCustomAttributes(typeof(ModifyChainAttribute))
                         .OfType <ModifyChainAttribute>())
                {
                    attribute.Modify(this, rules, container);
                }
            }

            var cascadingHandlers = determineCascadingMessages().ToArray();

            // The Enqueue cascading needs to happen before the post processors because of the
            // transactional & outbox support
            return(Middleware.Concat(Handlers).Concat(cascadingHandlers).Concat(Postprocessors).ToList());
        }
Beispiel #3
0
        public List <Frame> DetermineFrames()
        {
            if (!Handlers.Any())
            {
                throw new InvalidOperationException("No method handlers configured for message type " + MessageType.FullName);
            }

            if (!hasConfiguredFrames)
            {
                hasConfiguredFrames = true;

                applyAttributesAndConfigureMethods();

                foreach (var attribute in MessageType.GetTypeInfo().GetCustomAttributes(typeof(ModifyHandlerChainAttribute)).OfType <ModifyHandlerChainAttribute>())
                {
                    attribute.Modify(this);
                }

                foreach (var attribute in MessageType.GetTypeInfo().GetCustomAttributes(typeof(ModifyChainAttribute)).OfType <ModifyChainAttribute>())
                {
                    attribute.Modify(this);
                }
            }

            var cascadingHandlers = determineCascadingMessages().ToArray();

            return(Middleware.Concat(Handlers).Concat(Postprocessors).Concat(cascadingHandlers).ToList());
        }
Beispiel #4
0
        public List <Frame> DetermineFrames()
        {
            if (!Handlers.Any())
            {
                throw new InvalidOperationException("No method handlers configured for message type " + MessageType.FullName);
            }

            applyAttributesAndConfigureMethods();

            var i = 0;
            var cascadingHandlers = Handlers.Where(x => x.ReturnVariable != null)
                                    .Select(x => new CaptureCascadingMessages(x.ReturnVariable, ++i));

            return(Middleware.Concat(Handlers).Concat(cascadingHandlers).ToList());
        }