示例#1
0
文件: Commander.cs 项目: henkin/brisk
        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);
        }
示例#2
0
 private void Raise <TEntity>(EntityEvent <TEntity> created)
 {
     Eventer.Raise(created);
 }