Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:48:13+00:00 2026-05-24T02:48:13+00:00

I have been playing around with MVC-Mini-Profiler, and found it very useful. However, on

  • 0

I have been playing around with MVC-Mini-Profiler, and found it very useful. However, on all pages I trace on, I get reports of duplicate queries, like the one below.

However, I have traced the queries in SQL Server Profiler, and there is not doubt it only hits the DB once.

Am I missing a concept here or have I set it up the wrong way? I have searched high and low for people with similar problems, with no luck, so I doubt there is a bug.

Trace

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 use EF4 and have implemented the 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;

        // Let entity framework do the heavy-lifting to create the connection.
        using (var connection = new EntityConnection(entityConnectionString))
        {
            // Steal the connection that EF created.
            storeConnection = connection.StoreConnection;

            // Make EF forget about the connection that we stole (HACK!)
            connection.GetType().GetField("_storeConnection",
                BindingFlags.NonPublic | BindingFlags.Instance).SetValue(connection, null);

            // Return our shiny, new connection.
            return storeConnection;
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:48:14+00:00Added an answer on May 24, 2026 at 2:48 am

    I reported this to the Mini Profiler team (http://code.google.com/p/mvc-mini-profiler/issues/detail?id=62&can=1) and they’ve issued a patch today which appears to fix the issue.

    I imagine this will be included in the next release. Hope that helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been playing around with JavaScript and Canvas for a while. Very often
I have been playing around with this and wanted to get a second opinion.
I have been playing around lately with head.js but I have found a stranger
I have been playing around with a very simple HTML5/Canvas based drawing app, just
First post time, I've been playing around with MVC abit... I have a view
I have been playing around with MVC 3 and looking at populating dropdownlists. I
I have been playing around with the code found here . I'm getting things
i have been playing around with MVC. I am currently stumped on with html
I have been playing around with the concept of 'module' that some mvc frameworks
i have been playing around with apache SOLR since last 3 weeks and very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.