today I have faced a situation that broke all my working code. And I need some adveice please.
I am accessing the database using EF Core 5 and here is an example of how to access.
await Context.EntityName.Where(p => p.Id==id).FirstOrDefaultAsync(cancellationToken);
this code was working totaly fine but some how I started to get below error.
Error CS0121 The call is ambiguous between the following methods or properties: 'System.Linq.Queryable.Where<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.Expression<System.Func<TSource, bool>>)' and 'System.Linq.AsyncEnumerable.Where<TSource>(System.Collections.Generic.IAsyncEnumerable<TSource>, System.Func<TSource, bool>)'
I don't know why this error happened but only way to work aroung the problem is the adding .AsQueryable() before the Where
await Context.EntityName.AsQueryable().Where(p => p.Id==id).FirstOrDefaultAsync(cancellationToken);
Any idea what all this about ? why suddenly it happened ?
I have almost 1000 line code to change :(