Beispiel #1
0
        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;
        }
Beispiel #2
0
 public bool ShouldInterceptMethod(Type type, MethodInfo methodInfo)
 {
     return(ConfigurationMemberHelper.GetConfigurationMemberAttributeFromMethodInfo(methodInfo) != null);
 }