Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Web API re-uses same DbContext in different requests resulting data corruption

$
0
0

Hello,

I filed this issue on Github because I think this is a bug, but also put it here for others to test too.

Though DbContext should be created in every request (by default as "Scoped") it seems when the same request arrives in a very short time (ms range) ASP.NET Core still uses the existing one.

This leads to inconsistent data as transaction for two or more independent request is committed as one, mixing the values tracked by DbContext.

Please see a complete solution on the above link to demonstrate.

If anyone has any idea why this is happening please share.

Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>