예제 #1
0
        public void AddExceptionMessage(Exception exception)
        {
            new DomainLogger().LogException(exception);
            if (exception.InnerException != null)
            {

                var message = new DomainMessage
                {
                    Id = EMessageNumber.ExceptionMessage,
                    Message = string.IsNullOrEmpty(exception.InnerException.Message) ? string.Format("Exception: {0} Inner Exception: {1}", exception.Message, exception.InnerException.Message)
                                                               : string.Format("Exception: {0}", exception.Message),
                    Type = EMessageType.Error
                };
                _messages.Add(message);
            }
            else
            {
                var message = new DomainMessage
                {
                    Id = EMessageNumber.ExceptionMessage,
                    Message = string.Format("Exception: {0}", exception.Message),
                    Type = EMessageType.Error
                };
                _messages.Add(message);
            }
        }
예제 #2
0
 public static IDomainMessage Get(EMessageNumber number)
 {
     IDomainMessage result = new DomainMessage();
     if (!RegisteredMessages.ContainsKey(number))
     {
         return result;
     }
     if (!RegisteredMessages.TryGetValue(number, out result))
     {
         result = new DomainMessage();
     }
     return result;
 }