kzryzstof / mediatr-plugin

[Jetbrains] Ever got frustrated to find out where was the handler of a MediatR's IRequest? Say no more. This plugin provides a context action to easily reach the handler of any MediatR request. Select your MediatR request, click on that action and boom you will be automatically transported to the appropriate handler.
17 stars 1 forks source link

Go To HandlR not worked when handler class use inherited IRequestHandler #65

Open aalirezamoradii opened 1 month ago

aalirezamoradii commented 1 month ago
public interface ISharedCommandHandler<in TRequest, TResponse> : IRequestHandler<TRequest, Dto<TResponse>> where TRequest : IRequest<Dto<TResponse>>

public class XCommandRequest : IRequest<XCommandResponse> {}
public class XCommandResponse {}

public class XCommandHandler : ISharedCommandHandler<XCommandRequest, XCommandResponse>
{
    public async Task<Dto<XCommandResponse>> Handle(XCommandRequest request, , CancellationToken cancellationToken) {}
}

Go to handlR not working

kzryzstof commented 1 month ago

@aalirezamoradii Thanks for reporting the issue. Would it be possible for you to update the sample you provided? As of now, I get an error on the XCommandHandler stating that:

The type 'XCommandRequest' must be convertible to 'MediatR.IRequest<Dto<XCommandResponse>>' in order to use it as parameter 'TRequest' in the generic interface 'ISharedCommandHandler<in TRequest,TResponse>'

I do not want to make any assumptions while trying to fix this :)

aalirezamoradii commented 1 month ago

@kzryzstof

public interface ISharedCommandHandler<in TRequest, TResponse> : IRequestHandler<TRequest, Dto<TResponse>> where TRequest : IRequest<Dto<TResponse>>

public class XCommandRequest : IRequest<Dto<XCommandResponse>> {}
public class XCommandResponse {}

public class XCommandHandler : ISharedCommandHandler<XCommandRequest, XCommandResponse>
{
    public async Task<Dto<XCommandResponse>> Handle(XCommandRequest request, , CancellationToken cancellationToken) {}
}

Yes, I have made a mistake Thanks for respond

kzryzstof commented 1 month ago

Thanks! I am now able to reproduce the problem and will try to fix it as soon as possible.