ShortBus icon indicating copy to clipboard operation
ShortBus copied to clipboard

Following instructions in readme is a compilation error

Open togakangaroo opened this issue 11 years ago • 3 comments

I tried to create a simple command handler as in the example on the README but this is giving me a compilation error due to Handle not returning anything.

    public class UserRegistered : ICommandHandler<RegisterUser>
    {
        public void Handle(RegisterUser user) {
        }
    }

Versioning:

Id                             Version              Description/Release Notes
--                             -------              -------------------------
ShortBus                       3.0.46-beta          ShortBus is an in-process mediator with low-friction API
ShortBus.Markers               3.0.43-beta          ShortBus is an in-process mediator with low-friction API
ShortBus.StructureMap          3.0.48-beta          ShortBus is an in-process mediator with low-friction API
structuremap                   3.0.5.130            StructureMap is a Dependency Injection / Inversion of Control tool for .Net that can be used to improve the architectural qualities of an object oriented syst...
xunit                          1.9.2                xUnit.net is a developer testing framework, built to support Test Driven Development, with a design goal of extreme simplicity and alignment with framework fe...

togakangaroo avatar Jul 29 '14 00:07 togakangaroo

@togakangaroo Unless I dont understand the question, Commands don't return anything, as you can see Handle is void. Use a Query if you need to return something.

mxmissile avatar Aug 01 '14 13:08 mxmissile

I am also confused. Commands should not return anything, but if a command is to save a data do the database and get a new ID, how is this new ID supposed to get back to the client if a command can´t return a value ?

getuliojr avatar Dec 19 '14 20:12 getuliojr

Use IQuery (or in the latest IRequest?) when data is needed to be returned.

var data = mediator.Request(query).Data;

https://github.com/mhinze/ShortBus/blob/master/ShortBus.Tests/Example/BasicExample.cs

mxmissile avatar Dec 19 '14 20:12 mxmissile