Skip to content

Method ExecuteMethodAsync<T>

Namespace: Belay.Core
Assembly: Belay.Core.dll

ExecuteMethodAsync<T>(MethodInfo, object?, object?[]?, CancellationToken)

Executes a method with automatic executor selection based on attributes. This is the main entry point for the attribute-based programming model and uses secure execution context.

csharp
public Task<T> ExecuteMethodAsync<T>(MethodInfo method, object? instance = null, object?[]? parameters = null, CancellationToken cancellationToken = default)

Parameters

method MethodInfo

The method to execute.

instance object?

The instance to invoke the method on (null for static methods).

parameters object?[]?

The parameters to pass to the method.

cancellationToken CancellationToken

Cancellation token to cancel the execution.

Returns

Task<T>

The result of the method execution.

Type Parameters

T

The expected return type.

ExecuteMethodAsync(MethodInfo, object?, object?[]?, CancellationToken)

Executes a method without returning a value with automatic executor selection based on attributes.

csharp
public Task ExecuteMethodAsync(MethodInfo method, object? instance = null, object?[]? parameters = null, CancellationToken cancellationToken = default)

Parameters

method MethodInfo

The method to execute.

instance object?

The instance to invoke the method on (null for static methods).

parameters object?[]?

The parameters to pass to the method.

cancellationToken CancellationToken

Cancellation token to cancel the execution.

Returns

Task

A task representing the asynchronous operation.

Released under the Apache License 2.0.