You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Services/ServiceFunction.cs

21 lines
491 B

2 years ago
namespace Connected.Services;
public abstract class ServiceFunction<TArgs, TReturnValue> : ServiceOperation<TArgs>, IFunction<TArgs, TReturnValue>
where TArgs : IDto
{
protected TReturnValue Result { get; private set; } = default!;
public async Task<TReturnValue> Invoke(TArgs args)
{
if (args is null)
throw new ArgumentException(null, nameof(args));
Arguments = args;
Result = await OnInvoke();
return Result;
}
protected abstract Task<TReturnValue> OnInvoke();
}