Created
August 1, 2011 15:29
-
-
Save geoffreysmith/1118349 to your computer and use it in GitHub Desktop.
simplecqrs createcommand
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 abstract class CreateCommandHandler<TCommand> : CommandHandler<TCommand> where TCommand : ICommand | |
{ | |
public override void Handle(TCommand command) | |
{ | |
var aggregateRoot = CreateAggregateRoot(command); | |
Handle(command, aggregateRoot); | |
var domainRepository = ServiceLocator.Current.Resolve<IDomainRepository>(); | |
domainRepository.Save(aggregateRoot); | |
} | |
public abstract AggregateRoot CreateAggregateRoot(TCommand command); | |
public virtual void Handle(TCommand command, AggregateRoot aggregateRoot) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment