Tuesday 15 September 2015

c# - Entity Framework gets progressively slow with extra join added even though SQL generated is fast -


We have 18 tables which are specific to the ERP system. NTIT is included through the NTIT framework

The connectivity gradually decreases gradually because connecting more is added. Return result set is small (15 records) The LINQ generated query is captured via SQL Profiler and when we run it through the Microsoft Management Console, it is very fast: 10 ms. When we run it through our C # LINQ-over-EntityFramework it takes 4 seconds.

What do I think: The time it takes to compile the expression tree in SQL is 2 seconds in 4 seconds, and I think that another 2 seconds internally convert the SQL result Which is actually installed in C # classes. Apart from this, this institution is not connected to the beginning of the structure because we run some questions first and generate this recycled call in 4 seconds.

Is there a way to speed up this speed? Otherwise we are considering abandoning the unit framework to be completely disabled ...

You have correctly identified the obstacles if you have a lot of complex questions, then I recommend that you use compiled questions to overcome the SQL query conversion on Exclusion Tree.

You can refer to.

After spending a lot of time on my object graph, I would suggest using some other methods to get data separately from EF.

There may be an option, you can do your short SQL query and you can get straight results into solid model objects using Dapar (or any other small ORM)


1 comment: