Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save stijnmoreels/afc4335ef4c70006afaae6b4016b2305 to your computer and use it in GitHub Desktop.

Select an option

Save stijnmoreels/afc4335ef4c70006afaae6b4016b2305 to your computer and use it in GitHub Desktop.
string connectionString = "Server=sample-server;Database=sample-database;User=admin;Password=123";
using (var measurement = DependencyMeasurement.Start())
{
// Interact with database
var products = await _repository.GetProducts();
_logger.LogSqlDependency(connectionString, "my-table", "get-products", isSuccessful: true, measurement: measurement);
// Output: "SQL Dependency sample-server for sample-database/my-table for operation get-products in 00:00:01.2396312 at 03/23/2020 09:32:02 +00:00 (Successful: True - Context: )"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment