< Summary

Information
Class: Elsa.Workflows.Management.HostMethodParameterValueProviderContext
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: 8
Coverable lines: 8
Total lines: 40
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
get_ServiceProvider()100%210%
get_ActivityExecutionContext()100%210%
get_InputDescriptors()100%210%
get_Activity()100%210%
get_Parameter()100%210%
get_CancellationToken()100%210%
get_ParameterName()0%620%

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>
 22public readonly record struct HostMethodParameterValueProviderResult(bool Handled, object? Value)
 23{
 24    public static HostMethodParameterValueProviderResult Unhandled { get; } = new(false, null);
 25    public static HostMethodParameterValueProviderResult HandledValue(object? value) => new(true, value);
 26}
 27
 28/// <summary>
 29/// Context passed to <see cref="IHostMethodParameterValueProvider"/>.
 30/// </summary>
 031public record HostMethodParameterValueProviderContext(
 032    IServiceProvider ServiceProvider,
 033    ActivityExecutionContext ActivityExecutionContext,
 034    IReadOnlyCollection<Elsa.Workflows.Models.InputDescriptor> InputDescriptors,
 035    IActivity Activity,
 036    ParameterInfo Parameter,
 037    CancellationToken CancellationToken)
 38{
 039    public string ParameterName => Parameter.Name ?? string.Empty;
 40}