예제 #1
0
        public void Apply(ISpecificationPipeBuilder <PublishContext <TMessage> > builder)
        {
            if (!builder.IsDelegated && _implementedMessageTypeSpecifications.Count > 0)
            {
                var implementedBuilder = builder.CreateImplementedBuilder();

                for (var index = _implementedMessageTypeSpecifications.Count - 1; index >= 0; index--)
                {
                    _implementedMessageTypeSpecifications[index].Apply(implementedBuilder);
                }
            }

            var parentCount = _parentMessageSpecifications.Count;

            if (parentCount > 0)
            {
                var delegatedBuilder = builder.CreateDelegatedBuilder();

                for (var index = 0; index < parentCount; index++)
                {
                    _parentMessageSpecifications[index].Apply(delegatedBuilder);
                }
            }

            for (var index = 0; index < _specifications.Count; index++)
            {
                _specifications[index].Apply(builder);
            }

            if (!builder.IsImplemented)
            {
                for (var index = 0; index < _baseSpecifications.Count; index++)
                {
                    var split = new SplitFilterPipeSpecification <PublishContext <TMessage>, PublishContext>(_baseSpecifications[index], MergeContext,
                                                                                                             FilterContext);

                    split.Apply(builder);
                }
            }
        }
        public void Apply(ISpecificationPipeBuilder <SendContext <TMessage> > builder)
        {
            if (!builder.IsDelegated)
            {
                ISpecificationPipeBuilder <SendContext <TMessage> > implementedBuilder = builder.CreateImplementedBuilder();

                foreach (ISpecificationPipeSpecification <SendContext <TMessage> > specification in _implementedMessageTypeSpecifications.Reverse())
                {
                    specification.Apply(implementedBuilder);
                }
            }

            ISpecificationPipeBuilder <SendContext <TMessage> > delegatedBuilder = builder.CreateDelegatedBuilder();

            foreach (ISpecificationPipeSpecification <SendContext <TMessage> > specification in _parentMessageSpecifications)
            {
                specification.Apply(delegatedBuilder);
            }

            foreach (IPipeSpecification <SendContext <TMessage> > specification in _specifications)
            {
                specification.Apply(builder);
            }
        }
        public void Apply(ISpecificationPipeBuilder <PublishContext <TMessage> > builder)
        {
            if (!builder.IsDelegated && _implementedMessageTypeSpecifications.Count > 0)
            {
                ISpecificationPipeBuilder <PublishContext <TMessage> > implementedBuilder = builder.CreateImplementedBuilder();

                foreach (ISpecificationPipeSpecification <PublishContext <TMessage> > specification in _implementedMessageTypeSpecifications.Reverse())
                {
                    specification.Apply(implementedBuilder);
                }
            }

            ISpecificationPipeBuilder <PublishContext <TMessage> > delegatedBuilder = builder.CreateDelegatedBuilder();

            foreach (ISpecificationPipeSpecification <PublishContext <TMessage> > specification in _parentMessageSpecifications)
            {
                specification.Apply(delegatedBuilder);
            }

            foreach (IPipeSpecification <PublishContext <TMessage> > specification in _specifications)
            {
                specification.Apply(builder);
            }

            if (!builder.IsImplemented)
            {
                foreach (IPipeSpecification <PublishContext> specification in _baseSpecifications)
                {
                    var split = new SplitFilterPipeSpecification <PublishContext <TMessage>, PublishContext>(specification, MergeContext, FilterContext);

                    split.Apply(builder);
                }
            }
        }