Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Following instructions in readme is a compilation error #32

Open
togakangaroo opened this issue Jul 29, 2014 · 3 comments
Open

Following instructions in readme is a compilation error #32

togakangaroo opened this issue Jul 29, 2014 · 3 comments

Comments

@togakangaroo
Copy link

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...
@mxmissile
Copy link
Contributor

@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.

@getuliojr
Copy link

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 ?

@mxmissile
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants