Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
martin authored and martin committed Feb 14, 2022
1 parent cdd47eb commit 53d6e28
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Nuages.TaskRunner.Samples.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private static async Task MainAsync(string[] args)
var data = new OutputToConsoleTaskData( "Method 1 : Your name is : " + message);
await taskRunner.ExecuteAsync<OutputToConsoleTask, OutputToConsoleTaskData>(data);

//Execute the task : Method 2 (Data Typed)
//Execute the task : Method 2 (Untyped)
var taskDef = RunnableTaskDefinitionCreator<OutputToConsoleTask>.Create(new { Message = "Method 2 : Your name is : " + message });
await taskRunner.ExecuteAsync(taskDef);

Expand Down
2 changes: 0 additions & 2 deletions Nuages.TaskRunner/ITaskRunnerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ namespace Nuages.TaskRunner;
public interface ITaskRunnerService
{
Task<IRunnableTask> ExecuteAsync(RunnableTaskDefinition taskDef);
//Task<T> ExecuteAsync<T>(RunnableTaskDefinition taskDef) where T : IRunnableTask;
//Task<T> ExecuteAsync<T>(object data, string? userId = null) where T : IRunnableTask;
Task<T> ExecuteAsync<T,TD>(TD data, string? userId = null) where T : IRunnableTask;
}
14 changes: 1 addition & 13 deletions Nuages.TaskRunner/TaskRunnerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,13 @@ public TaskRunnerService( IServiceProvider serviceProvider, ILogger<TaskRunnerSe
_serviceProvider = serviceProvider;
_authorizers = authorizers;
}

// public async Task<T> ExecuteAsync<T>(RunnableTaskDefinition taskDef) where T : IRunnableTask
// {
// return (T) await ExecuteAsync(taskDef);
// }
//

public async Task<T> ExecuteAsync<T,TD>(TD data, string? userId = null) where T : IRunnableTask
{
var taskDef = RunnableTaskDefinitionCreator<T>.Create(data, userId);

return (T) await ExecuteAsync(taskDef);
}

// public async Task<T> ExecuteAsync<T>(object data, string? userId = null) where T : IRunnableTask
// {
// var taskDef = RunnableTaskDefinitionCreator<T>.Create(data, userId);
//
// return (T) await ExecuteAsync(taskDef);
// }

protected virtual async Task<bool> IsAuthorizedToRunAsync(RunnableTaskDefinition taskDef)
{
Expand Down

0 comments on commit 53d6e28

Please sign in to comment.