Is the query generated by the Entity Framework valid for use in ADO?

Asked

Viewed 59 times

3

I’m wanting to have a higher performance in a query I perform in the system

Consequently use ADO is much faster than Entity Framework

To query that it generates when performing the query, could be used to create a procedure or use with ADO?

Or is it exactly the query that it generates that makes it slow ?

1 answer

4


The query it generates when performing the query, could be used to create a precedent or use with ADO?

Yes.

The problem is that it is in a much more convenient format for manipulation by the Entity Framework than by a logic that you can develop.

Or is it exactly the query it generates that makes it slow?

In fact the query runs very fast. The problem is the transliteration of a result line into an object.

There are a number of rules that the Entity Framework uses to perform this transformation, and there are also a number of techniques to optimize speed, such as using Reflection to generate runtime classes and save time by defining objects in a static approach.

There is also the lazy load that makes this time increase considerably, since the Entity Framework needs to open a connection and execute a query for each aggregate entity of the original entity.

Completion

The Dapper was created precisely to solve this performance problem that you want to combat. I suggest taking a look instead of using pure ADO.NET.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.