Skip to content

Commit

Permalink
Core: change IOperationWorkflow signature
Browse files Browse the repository at this point in the history
- The parameter is passed to ExecuteAsync, instead of via the ctor
  • Loading branch information
KrzysFR committed Feb 9, 2024
1 parent 6b24ece commit 60aab20
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Doxense.Core/Threading/IOperationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public interface IOperationWorflow

public interface IOperationWorflow<TRequest, TResult> : IOperationWorflow
{
Task<OperationResult<TResult>> ExecuteAsync();
Task<OperationResult<TResult>> ExecuteAsync(TRequest request);
}

public interface IOperationWorflow<TWorkflow, TRequest, TResult> : IOperationWorflow<TRequest, TResult>
Expand All @@ -314,12 +314,12 @@ protected OperationWorflowBase(IOperationContext<TResult> context)
this.Context = context;
}

public Task<OperationResult<TResult>> ExecuteAsync()
public Task<OperationResult<TResult>> ExecuteAsync(TParameter request)
{
return this.Context.Scheduler.ExecuteOperation<TResult>(this.Context, _ => this.ExecuteInternalAsync());
return this.Context.Scheduler.ExecuteOperation<TResult>(this.Context, _ => this.ExecuteInternalAsync(request));
}

protected abstract Task<OperationResult<TResult>> ExecuteInternalAsync();
protected abstract Task<OperationResult<TResult>> ExecuteInternalAsync(TParameter request);

protected CancellationToken Cancellation => this.Context.Cancellation;

Expand All @@ -342,7 +342,7 @@ public Task<OperationResult<TResult>> ExecuteAsync()
protected OperationResult<TResult> Throw(Exception exception) => this.Context.Throw(exception);
//TOD: les autres!

public static TWorkflow CreateInstance(IServiceProvider services, string name, IOperationScheduler scheduler, TParameter req, CancellationToken ct)
public static TWorkflow CreateInstance(IServiceProvider services, string name, IOperationScheduler scheduler, CancellationToken ct)
{
var ctx = scheduler.Create<TResult>(name, null, null, ct);
return CreateInstance(services, ctx);
Expand Down

0 comments on commit 60aab20

Please sign in to comment.