C# .NET Core EF or ADO.NET query takes minutes and SSMS just 30 seconds, why?

ado.net database-performance entity-framework-core networking ssms

Question

So yeah, I'm currently stuck on a simple code that my app should do pretty quickly, considering the same query runs in SSMS in about 34 seconds and uses around 90mbps:

enter image description here

But then, look at what EF does while running the same query:

enter image description here

Not even using ADO.NET makes it go as fast as SSMS. What gives? I've yet to try this with .NET Framework. Currently using .NET Core 3.1. Is this a bug?

Any pointers are greatly welcome, thanks in advance!

1
0
1/26/2020 8:49:24 AM

Accepted Answer

For those who encounter the same issue as me: The issue was because I was (rightfully) using MultipleActiveResultSets=true. Turns out I'd have to disable it for this specific bit of code, then I can resume using it. Thanks to @Reza on https://stackoverflow.com/a/51824444/1598811 for that suggestion :)

0
1/26/2020 8:55:05 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow