public void Intercept(IInvocation invocation) { var configuration = ConfigurationMemberHelper.GetConfigurationMemberAttributeFromMethodInfo(invocation.Method) ?? throw new Exception($"No {nameof(ConfigurationMemberAttribute)} could be found, " + "this should be impossible at this point"); var result = _configurationRenderer.RenderSetting(configuration.Path, invocation.Method.ReturnType); invocation.ReturnValue = result.Value; }
public bool ShouldInterceptMethod(Type type, MethodInfo methodInfo) { return(ConfigurationMemberHelper.GetConfigurationMemberAttributeFromMethodInfo(methodInfo) != null); }