Replies: 1 comment
-
Have you tried reordering them like IdentityService then JwtService? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I implement JwtService from IJwtService at the Infrastructure layer
IJwtService declare at the Application layer
and
I implement IdentityService from IIdentityService at the Infrastructure layer
IJwtService declare at the Application layer
I register both at infrastructure dependency injection like
Then I implement LoginQueryHandler implement from : IRequestHandler<LoginViewModel, LoginDto>
within LoginQueryHandler() i inject IIdentityService and IJwtService
using mediator I send a request to LoginQuery Handler
public async Task Login([FromBody] LoginViewModel model)
{
public class LoginViewModel : IRequest
{
public string Email { get; set; }
public string Password { get; set; }
// public string? Token { get; set; }
}
public class LoginQueryHandler : IRequestHandler<LoginViewModel, LoginDto>
{
}
System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: MediatR.IRequestHandler`2[Application.Login.Queries.LoginViewModel,Application.Login.Queries.LoginDto] Lifetime: Transient ImplementationType: Application.Login.Queries.LoginQueryHandler': Unable to resolve service for type 'TechneTravel.Infrastructure.Services.JwtService' while attempting to activate 'TechneTravel.Infrastructure.Identity.IdentityService'.
---> System.InvalidOperationException: Unable to resolve service for type 'TechneTravel.Infrastructure.Services.JwtService' while attempting to activate 'TechneTravel.Infrastructure.Identity.IdentityService'.
Beta Was this translation helpful? Give feedback.
All reactions