Mediatr: How to register a custom IRequest/IRequestHandler interfaces without inheriting from MediatR interfaces?

Created on 6 Oct 2017  Â·  2Comments  Â·  Source: jbogard/MediatR

Hi people,

I would like to use a custom interface in my project for the pattern IRequest/IRequestHandler.
Currently my classes inherit from MediatR interfaces like this:

class DisableBlogCommand : IRequest { }
class DisableBlogCommandHandler : IRequestHandler<DisableBlogCommand> { }

I was wondering if is possible to use something this way without inheriting from MediatR:

class DisableBlogCommand : ICommand { }
class DisableBlogCommandHandler : ICommandHandler<DisableBlogCommand> { }
class DisableBlogDomainEvent : IDomainEvent { }
class DisableBlogCommandHandler : IDomainEventHandler<DisableBlogDomainEvent> { }

All 2 comments

Yeah you can just copy the code and make up your own interfaces really.

On Thu, Oct 5, 2017 at 7:45 PM Ivan Paulovich notifications@github.com
wrote:

Hi people,

I would like to use a custom interface in my project for the pattern
IRequest/IRequestHandler.
Currently my classes inherit from MediatR interfaces like this:

class DisableBlogCommand : IRequest { }
class DisableBlogCommandHandler : IRequestHandler { }

I was wondering if is possible to use something this way without
inheriting from MediatR:

class DisableBlogCommand : ICommand { }
class DisableBlogCommandHandler : ICommandHandler { }
class DisableBlogDomainEvent : IDomainEvent { }
class DisableBlogCommandHandler : IDomainEventHandler { }

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/jbogard/MediatR/issues/198, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAGYMj8VgwnVkXiJBn6_IRSNi_BR0yMIks5spXgdgaJpZM4Pv4W2
.

Thank you @jbogard!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mdmoura picture mdmoura  Â·  4Comments

ArturKarbone picture ArturKarbone  Â·  3Comments

grokky1 picture grokky1  Â·  4Comments

qazq picture qazq  Â·  3Comments

sq735 picture sq735  Â·  3Comments