Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MiniProfiler Tutorial #185

Open
Turnerj opened this issue Oct 14, 2020 · 3 comments
Open

Add MiniProfiler Tutorial #185

Turnerj opened this issue Oct 14, 2020 · 3 comments
Labels
documentation Documentation-related issue

Comments

@Turnerj
Copy link
Member

Turnerj commented Oct 14, 2020

Following on from #183 , this would be a tutorial about using MiniProfiler. The scope is much smaller as the intention is that someone knows how to use the basics of MongoFramework.

The tutorial should explain what MiniProfiler is, why it is useful and then show how to add it to the project. Finally, it should show an example of a successful profile of a query.

@Turnerj Turnerj added the documentation Documentation-related issue label Oct 14, 2020
@grounzero
Copy link

Have you an example of how to setup the MiniProfilerDiagnosticListener? I have miniProfiler running already.

@Turnerj
Copy link
Member Author

Turnerj commented Aug 17, 2021

This is what I do in my own application for configuring it:

var mainContextConnectionString = Configuration.GetConnectionString("MainContext");
var mainContextMongoUri = new MongoDB.Driver.MongoUrl(mainContextConnectionString);
services.AddTransient<IMongoDbConnection>(s =>
{
    var connection = MongoDbConnection.FromUrl(mainContextMongoUri);
    connection.DiagnosticListener = new MiniProfilerDiagnosticListener();
    return connection;
});

I really should make a fluent API for it as it would be a lot more concise.

@grounzero
Copy link

This is what I do in my own application for configuring it:

var mainContextConnectionString = Configuration.GetConnectionString("MainContext");
var mainContextMongoUri = new MongoDB.Driver.MongoUrl(mainContextConnectionString);
services.AddTransient<IMongoDbConnection>(s =>
{
    var connection = MongoDbConnection.FromUrl(mainContextMongoUri);
    connection.DiagnosticListener = new MiniProfilerDiagnosticListener();
    return connection;
});

I really should make a fluent API for it as it would be a lot more concise.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation-related issue
Projects
None yet
Development

No branches or pull requests

2 participants