public CommandResult <Update <TEntity> > Update <TEntity>(TEntity entity) where TEntity : Entity { var entityService = GetEntityService <TEntity>(); if (!entityService.Validate(entity)) { return new CommandResult <Update <TEntity> >(null) { IsSuccess = false } } ; entityService.Create(entity); var command = new Update <TEntity>(entity); Eventer.Raise <PersistenceEvent>(new Updated <TEntity>(entity)); Persister.Update(entity); var commandResult = new CommandResult <Update <TEntity> >(command) { IsSuccess = true }; return(commandResult); }
private void Raise <TEntity>(EntityEvent <TEntity> created) { Eventer.Raise(created); }