I have a simple stored procedure that I call the FromSqlRaw command.
db.Package.FromSqlRaw("EXEC dbo.sp_GetPackage").First();
In this case, get me the error that :
'FromSql' or 'SqlQuery' was called with non-composable SQL and with a query composing over it. Consider calling 'AsEnumerable' after the method to perform the composition on the client side.
Of course When I changed my code to :
db.Package.FromSqlRaw("EXEC dbo.sp_GetPackage").Tolist().First();
worked currently.
Actually, I should not use Tolist(). Can you help me?
Check that you are not using HasQueryFilter in the entity
modelBuilder.Entity(type).HasQueryFilter(predicate);
If this is the case, use .IgnoreQueryFilters() and do this:
customStorage.Set<Group>().FromSqlRaw(sql, userId).IgnoreQueryFilters().ToListAsync()
Or await
_db.RoleRecursiveDtos.FromSqlInterpolated(prCommand).IgnoreQueryFilters().ToListAsync(cancellationToken);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With