question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to save MiniProfiler data to Sql Database?

See original GitHub issue

I’m using the NuGet Package ‘MiniProfiler.AspNetCore.Mvc’ on my ASP .Net Core 2.2. I want write the data from the MiniProfiler directly to my Sql database. In the example in the startup.cs is something writen about options.Storage = new SqlServerStorage(""); SqlServerStorage does not seem to be available.

Is there another way to save the data to the database or do I need to include something else to get it to work?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
zinovcommented, Jun 5, 2020
        services.AddMiniProfiler(options =>
        {
            options.UserIdProvider = (request) => request.HttpContext.User.Identity.Name;
            options.Storage = new SqlServerStorage(connectionMiniProfiler);
            options.Storage.CreateSchema(); // THIS IS NOT AN AVAILABLE METHOD
        }).AddEntityFramework(); 
1reaction
NickCravercommented, May 18, 2019

Have you created the tables in SQL Server? MiniProfiler will use the tables, but not create them (since it’d require elevated permissions to do so).

If you are giving your app permissions to create the storage, you can do what the tests do (one time):

var storage = new SqlServerStorage("SqlConnectionString"); // your existing args are the default table names, so this is equivalent
storage.CreateSchema();

Or, you can generate the scripts it uses and spit them out to go run manually in whatever place you do database migrations. It’s a List<string> of commands to run from:

foreach (var cs in storage.TableCreationScripts)
{
    Console.WriteLine(cs);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

how to store MVC MiniProfiler results
I want to save the results of the MVC MiniProfiler to a sql server database. I profile a high load mvc4 page to...
Read more >
How-To Profile SQL Server (…or anything else using ADO. ...
MiniProfiler takes a wrapping approach to profiling, which means profiling SQL Server, MySQL, etc. is all the same because they're all based on...
Read more >
MiniProfiler in ASP.Net Core
If you want to persist the profile data, we have to use the database to store the profile results. Do the following to...
Read more >
Profiling Web API with Mini Profiler - I ❤️ DotNet
Install Nuget Package MiniProfiler.Providers. · Modify your Mini Profiler Configuration and pass the Provider in the options as shown below. Code ...
Read more >
Big Data - Disorderly Development
Displays current information about trends in real-time on a web dashboard; Stores information about the tweets into a SQL Azure database; Store the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found