Esempio n. 1
0
        public virtual MessageBase Push(MessageBase message)
        {
            if (message == null)
                throw new ArgumentNullException("message", "message cannot be null");

            var key = string.IsNullOrWhiteSpace(message.Id)
                          ? (message.Id = Guid.NewGuid().ToString("N"))
                          : message.Id;

            Messages[key] = message;

            return message;
        }
        public MessageBase Push(MessageBase message)
        {
            if (message == null)
                throw new ArgumentNullException("message", "message cannot be null");

            var simpleMessage = message as SimpleMessage;

            if(simpleMessage == null)
                throw new ArgumentException("Cookie Flash Storage only allows instances of SimpleMessage to be used!", "message");
            
            EnsureDataLoadedFromRequestCookie();

            _messages[message.Id] = (SimpleMessage)message;

            SaveExistingMessagesToResponseCookie();

            return message;
        }