Skip to content

Conversation

@yurekliisa
Copy link

No description provided.

@@ -1,5 +1,5 @@
{
"UseInMemoryDatabase": false,
"UseInMemoryDatabase": true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

services.AddMediatR(Assembly.GetExecutingAssembly());
//services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehaviour<,>));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed line

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionaly I'm not sure that is proper place to do it. There could be more suitable place.
For an example create method like below:

public static void AddMediatr(this IServiceCollcetion services){
   services.AddMediatr(Assembly...
   services.AddTransient(typeof(IPipelineBehavior....
}

and use it in AddApplicationLayer method instead of line 16. (services.AddMediatr...)

public AuthenticatedUserService(IHttpContextAccessor httpContextAccessor)
{
UserId = httpContextAccessor.HttpContext?.User?.FindFirstValue("uid");
Username = httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to the logging behavior. Should be commited in separate PR.

@@ -1,4 +1,5 @@
using AspNetCoreHero.Boilerplate.Application.Interfaces.Repositories;
using AspNetCoreHero.Boilerplate.Application.Exceptions;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed namespace

var requestName = typeof(TRequest).Name;
try
{
_logger.LogInformation("{Name} Request From User {UserId}-{UserName}", requestName, _authenticatedUserService.UserId, _authenticatedUserService.Username);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use _logger.LogDebug( because it can be very big amount of data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants