Пример #1
0
        public void Execute(IPlan plan)
        {
            var methods = GetCandidateMethods(plan.Type);

            foreach (var method in methods)
            {
                var attributes = method.GetCustomAttributes(
                    typeof(TAttribute), true) as TAttribute[];
                if (attributes.Length == 0)
                {
                    continue;
                }
                var advice = adviceFactory.Create(method);

                advice.Callback = request => (TInterceptor)request.Kernel.GetService(typeof(TInterceptor));
                adviceRegistry.Register(advice);

                if (!plan.Has <ProxyDirective>())
                {
                    plan.Add(new ProxyDirective());
                }
            }
        }