views:

133

answers:

1

Just wondering if this is the way to specify the order to run a handler (AuthorizationHandler) before all others?

public void SpecifyOrder(Order order)
{
    order.Specify(First<AuthorizationHandler>.Then<IHandleMessages<IMessage>>());
}

It just feels odd to add Then<IHandleMessages<IMessage>>().

Is there a nicer way of saying to the Bus execute x handler before all others?

+2  A: 

Specifying message handler order should not require you to list everything that might occur, only the message handlers that must receive priority. I think it would be sufficient in your case to use:

public void SpecifyOrder(Order order)
{
    order.Specify<AuthorizationHandler>();
}

With no ordering given for any other handlers, they should all execute in whatever order the configurer loads them in. Handlers will not be ignored simply because no order is given for them.

David