Try our conversational search powered by Generative AI!

Class CommandHandler

This class supports the EPiServer infrastructure and is not intended to be used directly from your code.

Inheritance
System.Object
CommandHandler
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Util
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public class CommandHandler

Constructors

CommandHandler()

Declaration
public CommandHandler()

Methods

RetryExecuteIfException(Action, Type, Int32, TimeSpan)

Tries to execute commad or action. Throw exception if the exception does not exist in the handledexptiontypes list or it occurs more than numberOfRetry.

Declaration
public static void RetryExecuteIfException(Action command, Type handledExceptionType, int numberOfRetry, TimeSpan waitFor)
Parameters
Type Name Description
System.Action command

The command.

System.Type handledExceptionType

The handled exception type.

System.Int32 numberOfRetry

number of try.

System.TimeSpan waitFor

The amount of time that we wait for the next call.

TryExecute(Action, out String)

Tries to execute commad or action.

Declaration
public static bool TryExecute(Action command, out string errorMessage)
Parameters
Type Name Description
System.Action command

The command or action.

System.String errorMessage

The error message.

Returns
Type Description
System.Boolean

true if the command executes without exception otherwise false

TryExecute(Action, out String, Type[])

Tries to execute commad or action. Throw exception if an exception occurs during execution and the exception does not exist in the handledexptiontypes list.

Declaration
public static bool TryExecute(Action command, out string errorMessage, params Type[] handledExceptionTypes)
Parameters
Type Name Description
System.Action command

The command.

System.String errorMessage

The error message.

System.Type[] handledExceptionTypes

The handled exception types.

Returns
Type Description
System.Boolean

true if the command executes without exception otherwise false

Extension Methods