Remiworks / EventBusFramework

Wrapper for RabbitMQ. This includes an attribute library for handling incoming events and commands.
GNU General Public License v3.0
1 stars 2 forks source link

Attribute method parameters can contain both an object or multiple properties of an object #3

Open mikederksen opened 6 years ago

mikederksen commented 6 years ago

Say you have the following object as a parameter:

public class Car
{
    public int NumOfWheels { get; set; }
    public string Brand { get; set; }
    public string Type { get; set; }
}

Right now this is declared as the following:

[Topic ("bla.something.car.created")]
public void HandleCarCreation(Car car)
{
    // Do some work
}

It would be nice to also be able to write this as the following:

[Topic ("bla.something.car.created")]
public void HandleCarCreation(int numOfWheels, string brand, string type)
{
    // Do some work
}

This way one can also choose to leave out some parameters. You can, for example, only have int numOfWheels and string brand as parameters and leave out the string type