3

Possible Duplicate:
How can I make the ASP.NET MVC mini profiler work with Linq 2 SQL?

This might be a duplicate of How can I make the ASP.NET MVC mini profiler work with Linq 2 SQL?, but none of the answers in that question are working for me.

I am using a DBML file (WebData.dbml) and its backing WebData.cs file as the models for my site. I added normanthesquid's code

    public static WebDataContext CreateNewContext()
    {
        var sqlConnection = new WebDataContext().Connection;
        var profiledConnection = MvcMiniProfiler.Data.ProfiledDbConnection.Get(sqlConnection);
        return new WebDataContext(profiledConnection);
    }

to the WebData.designer.cs file, but it's never getting called. What do I need to do to get it to be called?

Community
  • 1
  • 1
Bobson
  • 13,498
  • 5
  • 55
  • 80
  • I think it's the same problem as that question, but the solutions there don't seem to work for me. – Bobson Jul 08 '11 at 16:27
  • when that happens, posting a comment in that question will get people to see it and attract new eyes. – George Stocker Jul 08 '11 at 20:16
  • I'm starting to wonder if my question isn't actually separate. The other question was "how to get it to work", which got answered, and mine was "how to get his answer to work", which might be more of a linq-to-sql / DBML question than specifically a MVC-mini-profiler question. – Bobson Jul 11 '11 at 18:18
  • then a comment on his answer is appropriate, so the information isn't splintered. – George Stocker Jul 11 '11 at 18:30
  • 1
    @George - I'd love to do that... I just need to earn 12 more reputation somewhere first. I find it highly frustrating to be unable to get an answer to a problem I am currently having because I don't have enough reputation yet to ask it in the correct manner. I know that's not your fault, but it is very aggravating. – Bobson Jul 13 '11 at 14:38

1 Answers1

-1

You may download a sample from here and see what you are doing wrong. Try to install mini profiler using nuget so that you don't miss any step

Tassadaque
  • 8,129
  • 13
  • 57
  • 89
  • It was installed with nuget, so I assume it has installed everything. As for the sample, while I had missed the BaseController and the GetConnection() method there, it's not helpful to me (the handlers are, though, so thank you for getting me to take another look). I don't create new `WebDataContext()`s in my controllers (at least I haven't needed to yet). I can just access the Linq-to-SQL objects and build everything from them. So I need the _objects_ to use the connection. – Bobson Jul 08 '11 at 16:26
  • The sample you link to doesn't have a Linq 2 SQL example. I agree with @bobson, the Nuget install provides no help for this usage either. – RyanW Aug 26 '11 at 15:52