Method-level attributed interception with Simple Injector
问题 With Unity, I'm able to quickly add an attribute based interception like this public sealed class MyCacheAttribute : HandlerAttribute, ICallHandler { public override ICallHandler CreateHandler(IUnityContainer container) { return this; } public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) { // grab from cache if I have it, otherwise call the intended method call.. } } Then I register with Unity this way: container.RegisterType<IPlanRepository, PlanRepository>(