private APIFactory() { methodProxy = new MethodProxy(this); providers = new Dictionary <Type, Func <object> >(); RegisterSingleton(() => methodProxy); }
public RequireValueClass(IMethodProxy methodProxy, int x) { if (methodProxy is null) { throw new ArgumentNullException(nameof(methodProxy)); } X = x; }
public void Intercept(IInvocation invocation) { var attrs = invocation.Method.CustomAttributes.Select(p => p.AttributeType).ToList(); IMethodProxy lastMethodProxy = null; foreach (var attr in attrs) { if (attr == typeof(SafeExecuteAttribute)) { lastMethodProxy = new SafeExecuteAttribute(lastMethodProxy, invocation); } else if (attr == typeof(PerformanceLogAttribute)) { lastMethodProxy = new PerformanceLogAttribute(lastMethodProxy, invocation); } } lastMethodProxy.Execute(); }
public SafeExecuteAttribute(IMethodProxy nextProxy, IInvocation innerInvocation) : base(nextProxy, innerInvocation) { }
public PerformanceLogAttribute(IMethodProxy nextProxy, IInvocation innerInvocation) : base(nextProxy, innerInvocation) { }
public BaseMethodProxy(IMethodProxy nextProxy, IInvocation innerInvocation) { InnerInvocation = innerInvocation; NextProxy = nextProxy; }