Now register our 'AppLoggingBehavior' in the 'Startup. (LIne: 26) Finally logging the end request and its time taken into the console.(Line: 25) This line of code executes after completion of the 'Handler' execution which means now code executes in the backward direction. ![]() (Line: 24) Here awaiting 'RequestHandlerDelegate', so from here code execution either shift to 'IPipelineBehavior' if other exist or shift to the 'Handler'(like Query or Command).(Line: 22-23) Initialized 'StopWatch' instance.Mediation analysis is a technique that examines the intermediate process by which the independent variable affects the dependent variable. (Line: 21) Initial log information for our request. The tutorial is based on R and StatsNotebook, a graphical interface for R.(Line: 20) Creating a unique id to determine the starting log and ending log.(Line: 17) The 'Handle' method of 'IPipelineBehvior' will executes automatically.For this demo, we will target the 'console' log. (Line: 12-16) Injecting the 'ILogger' interface, using this we can either log to 'console', 'file', and 'database'.(Line: 10) Implementing the 'IPipelineBehavior'._logger.LogInformation($"Begin Request Id:") ![]() String unqiueId = Guid.NewGuid().ToString() String requestName = typeof(TRequest).Name Public async Task Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate next) ![]() Public AppLoggingBehaviour(ILogger> logger) Public class AppLoggingBehaviour : IPipelineBehavior Pipelines/AppLoggingBehavior.cs: using MediatR
0 Comments
Leave a Reply. |