Esempio n. 1
0
        protected bool Receiver(object message)
        {
            if (message is Cmd)
            {
                var cmd = message as Cmd;
                PersistAll(new[] { new Evt(cmd.Data + "-1"), new Evt(cmd.Data + "-2") }, UpdateStateHandler);
            }
            else if (message is DeleteMessagesSuccess)
            {
                if (AskedForDelete == null)
                {
                    throw new ArgumentNullException("Received DeleteMessagesSuccess without anyone asking for delete!");
                }
                AskedForDelete.Tell(message);
            }
            else if (message is DeleteMessagesFailure)
            {
                if (AskedForDelete == null)
                {
                    throw new ArgumentNullException("Received DeleteMessagesSuccess without anyone asking for delete!");
                }
                AskedForDelete.Tell(message);
            }

            else
            {
                return(false);
            }
            return(true);
        }
 protected bool Receiver(object message)
 {
     if (message is Cmd cmd)
     {
         RunTask(async() =>
         {
             await Task.Yield();
             await Task.Delay(100);
             PersistAll(new[] { new Evt(cmd.Data + "-1"), new Evt(cmd.Data + "-2") }, UpdateStateHandler);
         });
     }
     else if (message is DeleteMessagesSuccess)
     {
         if (AskedForDelete == null)
         {
             throw new ArgumentNullException("Received DeleteMessagesSuccess without anyone asking for delete!");
         }
         AskedForDelete.Tell(message);
     }
     else
     {
         return(false);
     }
     return(true);
 }