< Summary

Information
Class: Elsa.Workflows.Management.HostMethodParameterValueProviderResult
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Contracts/IHostMethodParameterValueProvider.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 40
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Handled()100%210%
get_Unhandled()100%210%
HandledValue(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Contracts/IHostMethodParameterValueProvider.cs

#LineLine coverage
 1using System.Reflection;
 2
 3namespace Elsa.Workflows.Management;
 4
 5/// <summary>
 6/// Provides an extensibility hook to resolve values for host method parameters.
 7/// Implementations can decide to resolve from workflow inputs, DI, context, or any other source.
 8/// </summary>
 9public interface IHostMethodParameterValueProvider
 10{
 11    /// <summary>
 12    /// Attempts to provide a value for the specified parameter.
 13    /// Return a handled result when a value was provided (including <c>null</c>), otherwise return <see cref="HostMetho
 14    /// to let other providers handle it.
 15    /// </summary>
 16    ValueTask<HostMethodParameterValueProviderResult> GetValueAsync(HostMethodParameterValueProviderContext context);
 17}
 18
 19/// <summary>
 20/// Result returned by <see cref="IHostMethodParameterValueProvider"/>.
 21/// </summary>
 022public readonly record struct HostMethodParameterValueProviderResult(bool Handled, object? Value)
 23{
 024    public static HostMethodParameterValueProviderResult Unhandled { get; } = new(false, null);
 025    public static HostMethodParameterValueProviderResult HandledValue(object? value) => new(true, value);
 26}
 27
 28/// <summary>
 29/// Context passed to <see cref="IHostMethodParameterValueProvider"/>.
 30/// </summary>
 31public record HostMethodParameterValueProviderContext(
 32    IServiceProvider ServiceProvider,
 33    ActivityExecutionContext ActivityExecutionContext,
 34    IReadOnlyCollection<Elsa.Workflows.Models.InputDescriptor> InputDescriptors,
 35    IActivity Activity,
 36    ParameterInfo Parameter,
 37    CancellationToken CancellationToken)
 38{
 39    public string ParameterName => Parameter.Name ?? string.Empty;
 40}