Tuesday, July 28, 2015

Entity Framework Connection Management

Some developers asked me to look into an issue they had with Entity Framework. A query that took milliseconds in SQL Server Management Studio, took minutes to execute when called through Entity Framework.

I had no clue what was the issue, but the following blog post brought some insights: http://www.brentozar.com/archive/2015/07/database-connection-hazards-with-entity-framework/. This post brought me to the following MSDN article where I saw the following note:

image

The trick is to call Entity Framework and materialize the results as quick as possible so the connection gets closed.

No comments: