예제 #1
0
        protected void applyAttributesAndConfigureMethods(JasperGenerationRules rules)
        {
            var handlers         = handlerCalls();
            var configureMethods = handlers.Select(x => x.HandlerType).Distinct()
                                   .SelectMany(x => x.GetTypeInfo().GetMethods())
                                   .Where(isConfigureMethod);

            foreach (var method in configureMethods)
            {
                method?.Invoke(null, new object[] { this });
            }

            var handlerAtts = handlers.SelectMany(x => x.HandlerType.GetTypeInfo()
                                                  .GetCustomAttributes <TModifyAttribute>());

            var methodAtts = handlers.SelectMany(x => x.Method.GetCustomAttributes <TModifyAttribute>());

            foreach (var attribute in handlerAtts.Concat(methodAtts))
            {
                attribute.Modify(this.As <TChain>(), rules);
            }

            var genericHandlerAtts = handlers.SelectMany(x => x.HandlerType.GetTypeInfo()
                                                         .GetCustomAttributes <ModifyChainAttribute>());

            var genericMethodAtts = handlers.SelectMany(x => x.Method.GetCustomAttributes <ModifyChainAttribute>());

            foreach (var attribute in genericHandlerAtts.Concat(genericMethodAtts))
            {
                attribute.Modify(this, rules);
            }
        }
예제 #2
0
 public override void Modify(IChain chain, JasperGenerationRules rules)
 {
     chain.Middleware.AddRange(_frameTypes.Select(x => Activator.CreateInstance(x).As <Frame>()));
 }
예제 #3
0
 public abstract void Modify(IChain chain, JasperGenerationRules rules);