public IAsyncService<TReq>
{
Task<object> ExecuteAsync<TReq>(TReq req);
}
public class ServiceBase<TReq> : IAsyncService<TReq>
{
...
public Task<object> RunAsync(TReq req) { ... }
...
}
[Route("/test", IsAsync = true)]
public class Test
{
}
public class TestService : ServiceBase<Test>
{
public async override Task<object> RunAsync(TReq req)
{
var asyncIOResult1 = await IO.GetFileAsync("...");
var result = await Analyzer.AnalyzeFileAsync(asyncIOResult1);
return new TestResponse { Result = result };
}
}
Do the same thing with REST services, ie IAsyncPostService
etc
Same consistent style for IOneWayService
- [Route("/test", IsOneWay = true)]
.
BTW we should also create IOneWayPostService
etc (REST services)
Consistent == intuitive.