Exemplo n.º 1
0
 /// <summary>
 /// Executes an action synchronously within the bot policy.
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <param name="action">The action to execute.</param>
 /// <param name="token">Tha cancellation token.</param>
 public static void Execute(this IBotPolicy policy, Action action, CancellationToken token = default) =>
 policy.Execute(new ParameterlessBotOperation(action), Guid.NewGuid(), token);
Exemplo n.º 2
0
 /// <summary>
 /// Executes an action synchronously within the bot policy.
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <param name="action">The action to execute.</param>
 /// <param name="token">Tha cancellation token.</param>
 public static void Execute(this IBotPolicy policy, Action <ExecutionContext, CancellationToken> action, CancellationToken token = default) =>
 policy.Execute(new BotOperation(action), Guid.NewGuid(), token);
Exemplo n.º 3
0
 /// <summary>
 /// Executes an opeariont synchronously within the bot policy and returns with its result.
 /// </summary>
 /// <typeparam name="TResult">The result type of the given operation.</typeparam>
 /// <param name="policy">The policy.</param>
 /// <param name="operation">The operation to execute.</param>
 /// <param name="token">Tha cancellation token.</param>
 /// <returns>The operations result.</returns>
 public static TResult Execute <TResult>(this IBotPolicy <TResult> policy, Func <ExecutionContext, CancellationToken, TResult> operation, CancellationToken token = default) =>
 policy.Execute(new BotOperation <TResult>(operation), Guid.NewGuid(), token);
Exemplo n.º 4
0
 /// <summary>
 /// Executes an opeariont synchronously within the bot policy and returns with its result.
 /// </summary>
 /// <typeparam name="TResult">The result type of the given operation.</typeparam>
 /// <param name="policy">The policy.</param>
 /// <param name="operation">The operation to execute.</param>
 /// <param name="token">Tha cancellation token.</param>
 /// <returns>The operations result.</returns>
 public static TResult Execute <TResult>(this IBotPolicy <TResult> policy, Func <TResult> operation, CancellationToken token = default) =>
 policy.Execute(new ParameterlessBotOperation <TResult>(operation), Guid.NewGuid(), token);
Exemplo n.º 5
0
 /// <summary>
 /// Executes an action synchronously within the bot policy.
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <param name="action">The action to execute.</param>
 /// <param name="correlationId">The correlation id.</param>
 /// <param name="token">Tha cancellation token.</param>
 public static void Execute(this IBotPolicy policy, Action action,
                            object correlationId, CancellationToken token = default) =>
 policy.Execute(new ParameterlessBotOperation(action), correlationId, token);
Exemplo n.º 6
0
 /// <summary>
 /// Executes an opeariont synchronously within the bot policy and returns with its result.
 /// </summary>
 /// <typeparam name="TResult">The result type of the given operation.</typeparam>
 /// <param name="policy">The policy.</param>
 /// <param name="operation">The operation to execute.</param>
 /// <param name="correlationId">The correlation id.</param>
 /// <param name="token">Tha cancellation token.</param>
 /// <returns>The operations result.</returns>
 public static TResult Execute <TResult>(this IBotPolicy <TResult> policy, Func <ExecutionContext, CancellationToken, TResult> operation,
                                         object correlationId, CancellationToken token = default) =>
 policy.Execute(new BotOperation <TResult>(operation), correlationId, token);
Exemplo n.º 7
0
 /// <summary>
 /// Executes an action synchronously within the bot policy.
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <param name="action">The action to execute.</param>
 /// <param name="correlationId">The correlation id.</param>
 /// <param name="token">Tha cancellation token.</param>
 public static void Execute(this IBotPolicy policy, Action <ExecutionContext, CancellationToken> action,
                            object correlationId, CancellationToken token = default) =>
 policy.Execute(new BotOperation(action), correlationId, token);
Exemplo n.º 8
0
 /// <summary>
 /// Executes an opeariont synchronously within the bot policy and returns with its result.
 /// </summary>
 /// <typeparam name="TResult">The result type of the given operation.</typeparam>
 /// <param name="policy">The policy.</param>
 /// <param name="operation">The operation to execute.</param>
 /// <param name="correlationId">The correlation id.</param>
 /// <param name="token">Tha cancellation token.</param>
 /// <returns>The operations result.</returns>
 public static TResult Execute <TResult>(this IBotPolicy <TResult> policy, Func <TResult> operation,
                                         object correlationId, CancellationToken token = default) =>
 policy.Execute(new ParameterlessBotOperation <TResult>(operation), correlationId, token);