Skip to content

[Not a bug] When to use ICommand vs IRequest? Docs say differently from the code examples? #1875

@jeffward01

Description

@jeffward01

Hello all!

This library is excellent!!! Very clean, easy to use and powerful!

I am confused on when to use ICommand vs IRequest

The code and documentation says IRequest is a base class of IEvent and ICommand. That is great. I assume when you want to be more explicit and ensure your Command is only processed by command handlers and not Event Handlers you would use ICommand, and when you want to be more loose about it, you could use IRequest?

Here is the only part in the documentation where it speaks about this: https://paramore.readthedocs.io/en/latest/DispatchingARequest.html#using-the-base-class-when-dispatching-a-message

From the source code:

I am confused, because if I understand this correctly, the docs are telling us to use ICommand or IEvent, rather than IRequest.

However, in all of the code examples in the documentation, IRequest is used. From looking at the code, it appears IRequest is what you would want to use, however the documentation makes me think that I should not use IReqest

Can someone please clarify what is best practice for this? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions