I call a stored procedure from EF that deletes some records and then immediately call a query to get the remaining records. That query uses Single()
in it which is throwing an error
Sequence contains no elements
But after this error, if I stop and restart the code, it shows the records just fine. So I'm thinking the deletion of the records the stored procedure is doing (it's getting committed) is messing up the EF context.
I do call dbContext.SaveChanges()
after the stored procedure is run. Why is the EF DbContext having issues querying after a delete statement is ran from a stored procedure?