I played with MVC-Mini-Profiler and found it very useful. However, on all the pages on which I am tracing, I get reports of repeated requests, as shown below.
However, I tracked the queries in SQL Server Profiler, and there is no doubt that it only accesses the database once.
Did I skip the concept here or didn't configure it the wrong way? I searched high and low for people with similar problems, no luck, so I doubt there is a mistake.

http://localhost:27941/clubs T+175.2 ms Reader 13.6 ms utePageHierarchy Execute System.Collections.Generic.IEnumerable<T>.GetEnumerator GetResults Execute ExecuteStoreCommands SELECT [Extent1].[TeamId] AS [TeamId], [Extent1].[Title] AS [Title], [Extent1].[TitleShort] AS [TitleShort], [Extent1].[LogoImageId] AS [LogoImageId], [Extent1].[Slug] AS [Slug], (SELECT COUNT(1) AS [A1] FROM [dbo].[Athletes] AS [Extent2] WHERE [Extent1].[TeamId] = [Extent2].[TeamId]) AS [C1] FROM [dbo].[Teams] AS [Extent1] WHERE 352 = [Extent1].[CountryId] http://localhost:27941/clubs T+175.4 ms DUPLICATE Reader 13.4 ms utePageHierarchy Execute System.Collections.Generic.IEnumerable<T>.GetEnumerator GetResults Execute ExecuteStoreCommands SELECT [Extent1].[TeamId] AS [TeamId], [Extent1].[Title] AS [Title], [Extent1].[TitleShort] AS [TitleShort], [Extent1].[LogoImageId] AS [LogoImageId], [Extent1].[Slug] AS [Slug], (SELECT COUNT(1) AS [A1] FROM [dbo].[Athletes] AS [Extent2] WHERE [Extent1].[TeamId] = [Extent2].[TeamId]) AS [C1] FROM [dbo].[Teams] AS [Extent1] WHERE 352 = [Extent1].[CountryId
I am using EF4 and have implemented a context like this:
public class BaseController : Controller { public ResultsDBEntities _db; public BaseController() { var rootconn = ProfiledDbConnection.Get(GetStoreConnection(ConfigurationManager.ConnectionStrings["ResultsDBEntities"].ConnectionString)); var conn = ProfiledDbConnection.Get(rootconn); _db = ObjectContextUtils.CreateObjectContext<ResultsDBEntities>(conn); } public static DbConnection GetStoreConnection<T>() where T : System.Data.Objects.ObjectContext { return GetStoreConnection("name=" + typeof(T).Name); } public static DbConnection GetStoreConnection(string entityConnectionString) { DbConnection storeConnection;
Kjensen
source share