Created
May 29, 2010 17:11
-
-
Save NeilRobbins/418382 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IHandleCommands<TCommand> where TCommand : IAmACommand | |
| { | |
| void Handle(TCommand command); | |
| } | |
| public interface IAmACommand | |
| { | |
| Guid AggregateId { get; } | |
| } | |
| public class AddLineToInvoiceCommandHandler : IHandleCommands<AddLineToInvoiceCommand> | |
| { | |
| public void Handle(AddLineToInvoiceCommand command) | |
| { | |
| // ... Do Something here to handle the command, for anything else | |
| // E.g. transactions, logging, etc... use the decorator pattern | |
| } | |
| } | |
| public class AddLineToInvoiceCommand | |
| { | |
| Guid _aggregateId; | |
| long _quantity; | |
| Guid _itemId; | |
| public AddLineToInvoiceCommand(Guid invoiceAggregateId, long quantity, Guid itemId) | |
| { | |
| _aggregateId = invoiceAggregateId; | |
| _quantity = quantity; | |
| _itemId = itemId; | |
| } | |
| public Guid AggregateId | |
| { get { return _aggregateId; } } | |
| public long Quantity | |
| { get { return _quantity; } } | |
| public Guid ItemId | |
| { get { return _itemId; } } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment