.ToListAsync() Support?
kmanev073 opened this issue · 1 comments
kmanev073 commented
Hi, all!
I just wanted to report a strange behavior I encountered today.
I am using:
- AutoMapper 13.0.0
- AutoMapper.Extensions.ExpressionMapping 7.0.0
- Microsoft.EntityFrameworkCore 8.0.1
Basically, if you use the expression mapping with EFCore like this: dbContext.DbSet.UseAsDataSource().For<TEntity>().ToListAsync();
you will get the following exception thrown:
System.InvalidOperationException: The source 'IQueryable' doesn't implement 'IAsyncEnumerable<TEntity>'. Only sources that implement 'IAsyncEnumerable' can be used for Entity Framework asynchronous operations.
Is there a workaround for this? I am currently forced to map my expressions manually and use .ProjectTo<>()
in order to be able to use .ToListAsync()
.
Thank you in advance!
BlaiseD commented
I'd recommend this approach instead.