Skip to content

[Feature]: Cortex.Mediator - Add Non Returning Command Interface (ICommand) #141

Description

@shabanlushaj

Is your feature request related to a problem? Please describe.

The existing ICommand interface forces every command to specify a return type, even for operations that conceptually do not produce one — for example:

public class DeletePortalCommand : ICommand<Unit>
{
    public Guid PortalId { get; set; }
}

Using Unit as a workaround feels less natural and slightly verbose.
In our CQRS implementation, commands that mutate state usually do not return results — they raise events most of the time.

Describe the solution you'd like

Currently, all commands in the Cortex Mediator library implement the generic interface ICommand, which implies that every command must return a value.

I’d like to request the addition of a non-generic ICommand interface for commands that do not return a result.

Describe alternatives you've considered

Currently considering moving away from MediatR due to compliance requirements.

As part of this transition, we are evaluating alternative mediator libraries that provide similar functionality and structure, with minimal impact on our existing codebase. The goal is to find (or adapt) a solution that allows us to migrate from MediatR with as little refactoring as possible, maintaining the same CQRS and mediator patterns that our system already relies on.

Thank you for your work on Cortex.Mediator and OS.

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfeatureThis label is in use for minor version increments

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions