MongoFramework
MongoFramework copied to clipboard
Add MiniProfiler Tutorial
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.
Have you an example of how to setup the MiniProfilerDiagnosticListener
? I have miniProfiler running already.
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.
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