✅ EFCore fetching all data in nearly all tables after a single insert
So today I encountered the weirdest error, for which I cannot create a minimal reproducible project.
But maybe any of you has any clue on how this is even possible or even why it occours.
The project is a .NET7 WebAPI with EFCore pointing towards an SQLServer 2019.
We had an object using an auto incrementing
We changed that to use a
We used this strong ID implementation multiple times and it works without any problems.
Now we had a implicit conversion on the ID for convenience.
Now EFCore started to literally fetch the entire database into memory after doing the single and correct
Always selecting all properties of the entire table and sending it back to the client.
Removing the implicit conversion completely resolved this.
This did not happen if it was isolated in a unit test and ran against a test database instance.
Because of that it most likely is some configuration on the DBContext or the project.
I'm at a complete loss, so maybe one of you has any inkling what the cause of this could be.
But maybe any of you has any clue on how this is even possible or even why it occours.
The project is a .NET7 WebAPI with EFCore pointing towards an SQLServer 2019.
We had an object using an auto incrementing
int ID.We changed that to use a
StronglyTypedId We used this strong ID implementation multiple times and it works without any problems.
Now we had a implicit conversion on the ID for convenience.
Now EFCore started to literally fetch the entire database into memory after doing the single and correct
INSERTAlways selecting all properties of the entire table and sending it back to the client.
Removing the implicit conversion completely resolved this.
This did not happen if it was isolated in a unit test and ran against a test database instance.
Because of that it most likely is some configuration on the DBContext or the project.
I'm at a complete loss, so maybe one of you has any inkling what the cause of this could be.