Fix activity of T result
This commit is contained in:
parent
6d15c536f3
commit
577e8fa30d
43
src/modules/Elsa.Workflows.Core/Models/ActivityT.cs
Normal file
43
src/modules/Elsa.Workflows.Core/Models/ActivityT.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using Elsa.Expressions.Models;
|
||||
using Elsa.Workflows.Core.Contracts;
|
||||
|
||||
namespace Elsa.Workflows.Core.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for custom activities that return a result.
|
||||
/// </summary>
|
||||
public abstract class Activity<T> : Activity, IActivityWithResult<T>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected Activity(string? source = default, int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected Activity(string activityType, int version = 1, string? source = default, int? line = default) : base(activityType, version, source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected Activity(MemoryBlockReference? output, string? source = default, int? line = default) : this(source, line)
|
||||
{
|
||||
if (output != null) Result = new Output<T>(output);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected Activity(Output<T>? output, string? source = default, int? line = default) : this(source, line)
|
||||
{
|
||||
Result = output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The result of the activity.
|
||||
/// </summary>
|
||||
public Output<T>? Result { get; set; }
|
||||
|
||||
Output? IActivityWithResult.Result
|
||||
{
|
||||
get => Result;
|
||||
set => Result = (Output<T>?)value;
|
||||
}
|
||||
}
|
||||
|
|
@ -96,37 +96,4 @@ public abstract class CodeActivity<T> : CodeActivity, IActivityWithResult<T>
|
|||
get => Result;
|
||||
set => Result = (Output<T>?)value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for custom activities that return a result.
|
||||
/// </summary>
|
||||
public abstract class Activity<T> : Activity
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected Activity(string? source = default, int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected Activity(string activityType, int version = 1, string? source = default, int? line = default) : base(activityType, version, source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected Activity(MemoryBlockReference? output, string? source = default, int? line = default) : this(source, line)
|
||||
{
|
||||
if (output != null) Result = new Output<T>(output);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected Activity(Output<T>? output, string? source = default, int? line = default) : this(source, line)
|
||||
{
|
||||
Result = output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The result of the activity.
|
||||
/// </summary>
|
||||
public Output<T>? Result { get; set; }
|
||||
}
|
||||
Loading…
Reference in a new issue