Entity Framework Core - Delay on seeing added records

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Posts: 1
Joined: Thu 06 May 2021 14:37

Entity Framework Core - Delay on seeing added records

Post by Kevin253 » Thu 06 May 2021 14:43

Hi Guys,

I've got a integration where I'm doing some process for a third party component and then inserting the response packet in the database before the original REST call returns. The third party component then looks up that response to report back to the user what has happened (unfortunately I cannot really return the packet immediately as the component we're integrating takes ages to write a client for so we have a common "poke the database object with JSON Path" approach to returning data). Both request and response lookup are handled by the same ASP.Net Core Web API process.

The problem I'm getting is the second part of the process is not seeing the database record immediately. All the data on the database suggests this has all been completed within a tenth of a second but I'm having to wait 5 seconds before retrieving the record. Indeed I've seen the retrieval process pause on a lookup loop while I can already see the record in the database via SqlServer Managment Studio. Manual inspection is finding these records faster than a process...

Is there some sort of global cache on EFC I need to flush or something to get this to come through. I'm recreating my context with each request so I'd assumed this would be enough to ensure that everything is committed and ready to be read before we return from the original process. It seems odd that the core process cannot see the records it has updated when other processes very much can.

Everything is async if that makes a difference, from the web api through to the datalayer. As I understand it a web api call cannot return until all the async operations it depends upon are completed. There aren't any missing awaits anywhere.

Thanks in advance
Last edited by Kevin253 on Sat 15 May 2021 16:55, edited 1 time in total.

Site Admin
Posts: 9302
Joined: Thu 14 Aug 2008 12:44

Re: Entity Framework Core - Delay on seeing added records

Post by Shalex » Fri 07 May 2021 13:49

Refer to https://www.reddit.com/r/csharp/comment ... ing_added/.

If the issue is caused by the code generated with Entity Developer, please send us a test project for reproducing.

Post Reply