Support async operation in ValueResolver natively
See original GitHub issueCurrently I have the following code:
public class OrderNumberResolver : ValueResolver<Order, int>
{
private readonly IOrderService _service;
public OrderNumberResolver(IOrderService service)
{
_service = service;
}
protected override int ResolveCore(Order order)
{
return Task.Run(async () => await _service.GetOrder(order.OrderId))
.Result
.OrderNumber;
}
}
But it would be nice to have something like that:
public class OrderNumberResolver : ValueResolver<Order, int>
{
private readonly IOrderService _service;
public OrderNumberResolver(IOrderService service)
{
_service = service;
}
protected override async Task<int> ResolveCoreAsync(Order order)
{
var order = await _service.GetOrder(order.OrderId);
return order.OrderNumber;
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (10 by maintainers)
Top Results From Across the Web
AutoMapper Custom Value Resolvers async
I want to convert BotViewModel to Bot using AutoMapper. There is an example input below from type BotViewModel .
Read more >Support async operation in ValueResolver natively
Currently I have the following code: public class OrderNumberResolver : ValueResolver<Order, int> { private readonly IOrderService _service; ...
Read more >Async functions | Can I use... Support tables for HTML5 ...
Async functions make it possible to treat functions returning Promise objects as if they were synchronous. Usage % of. all users, all tracked,...
Read more >Asynchronous support
Any view can be declared async by making the callable part of it return a coroutine - commonly, this is done using async...
Read more >Does PHP really not support asynchronous calls natively?
Caller can put in Guzzle\Promise\Coroutine function myAsyncFn(): Generator ... So you can say it: PHP supports async programming natively.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is what I came up with: https://github.com/Narochno/Narochno.AsyncMapper
People seem to disagree that I should need to do this at all. Composing a domain object from multiple sources feels like a valid use case and some of those sources would need to be async.
Well that makes two of us!
On Sat, May 14, 2016 at 11:36 AM, Alexander Batishchev < notifications@github.com> wrote: