Closed ftrMorri closed 1 year ago
Mapster already has some underlying issues that can cause problems when using ProjectToType() in certain situations that involve async code. These issues will need to be resolved first. It is advisable to materialize queries with ToList() first before calling ProjectToType().
@andrerav I know this is a relatively old and already closed issue, but what are you specifically referring to when it comes to async issues in relation to Mapster? I noticed I'm still using ProjectToType
in an async context in many places, but was unaware of it causing any issues.
Is Mapster.Async available only for Adapt(), and not for projections?
What I would like is something like this
I'm not sure if I understand the inner workings correctly, but wouldn't this still execute the database call + projection synchronously, and just the ToList() operation asynchronously?
return await data.ProjectToType<List<SomeDto>>().ToListAsync();