There are plenty of reasons to choose Entity Framework as your database ORM (object-relational mapping) over something like Dapper that exposes SQL directly. But if you don’t know what EF is doing under the hood, it is dangerously easy to write innocuous looking code with abysmal performance. This article show you how to get optimal performance from your queries and how to avoid the worst pitfalls.