I’m looking at analysing the performance of the SQL generated from Entity Framework 1, using MS SQL 2008.
When I run a trace in SQL Server Profiler 2008, I noticed something that I didn’t expect. For each query that gets executed, I get two RPC:Completed statements, separated by an exec sp_reset_connection statement. Is this the expected behavior?

Answer: Yes
It turns out that it was a “feature” within AutoMapper that was causing my issue.
See here: When Mapping an IQueryable I see the database getting hit twice in my profiler.
Unfortunately because I’m using version 1.1 (.net 3.5) this doesn’t look like it’s going to get fixed.
Solution: call
.ToList()on the IQueryable object before passing it into theMapper.Map()method. Allowing the Mapper to enumerate the object causes a double execution.