private string[] GetInstanceNames(IMethodInvocation input) { string formattedInstanceName = new MethodInvocationFormatter(input).Format(instanceName); if (useTotalCounter) { return(new string[] { TotalInstanceName, formattedInstanceName }); } return(new string[] { formattedInstanceName }); }
/// <summary> /// Performs the operation of the handler. /// </summary> /// <param name="input">Input to the method call.</param> /// <param name="getNext">Delegate used to get the next delegate in the call handler pipeline.</param> /// <returns>Returns value from the target method, or an <see cref="UnauthorizedAccessException"/> /// if the call fails the authorization check.</returns> public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) { IAuthorizationProvider authProvider = GetAuthorizationProvider(); ReplacementFormatter formatter = new MethodInvocationFormatter(input); if (!authProvider.Authorize(Thread.CurrentPrincipal, formatter.Format(operationName))) { UnauthorizedAccessException unauthorizedExeption = new UnauthorizedAccessException(Resources.AuthorizationFailed); return(input.CreateExceptionMethodReturn(unauthorizedExeption)); } return(getNext().Invoke(input, getNext)); }