Class Message
- Namespace
- ArcanaDevelopment.adTempus.Shared
- Assembly
- ArcanaDevelopment.adTempus.Shared.dll
[DataContract]
public class Message
- Inheritance
-
objectMessage
Constructors
Message()
protected Message()
Message(MessageType, string)
Creates a Message for the specified message code.
public Message(MessageType type, string code)
Parameters
| Name | Type | Description |
|---|---|---|
type |
MessageType | |
code |
string |
Remarks
This method can only be used for one of the predefined code values.
The Text for the code is loaded from the resource file.
Properties
AdditionalCode
[IgnoreDataMember]
public string AdditionalCode { get; set; }
Property Value
- string
AdditionalInformation
[IgnoreDataMember]
public string AdditionalInformation { get; set; }
Property Value
- string
AdditionalMessages
Additional messages associated with the primary message.
[IgnoreDataMember]
public MessageCollection AdditionalMessages { get; }
Property Value
AdditionalProperties
Additional attributes associated with the message.
[IgnoreDataMember]
public Dictionary<string, string> AdditionalProperties { get; }
Property Value
- Dictionary<string, string>
Aspect
[IgnoreDataMember]
public string Aspect { get; set; }
Property Value
- string
AspectFriendlyName
[IgnoreDataMember]
public string AspectFriendlyName { get; set; }
Property Value
- string
Code
[IgnoreDataMember]
public string Code { get; set; }
Property Value
- string
DebuggingInformation
[IgnoreDataMember]
public string DebuggingInformation { get; set; }
Property Value
- string
Description
[IgnoreDataMember]
public string Description { get; set; }
Property Value
- string
ExceptionType
[DataMember]
public int ExceptionType { get; set; }
Property Value
- int
FormattedMessageCode
public string FormattedMessageCode { get; }
Property Value
- string
HelpContext
[DataMember]
public string HelpContext { get; set; }
Property Value
- string
HelpFile
[DataMember]
public string HelpFile { get; set; }
Property Value
- string
Hidden
Indicates whether the user has hidden this message.
[DataMember]
public bool Hidden { get; set; }
Property Value
- bool
Hideable
Indicates whether the user is allowed to hide this message so that it is not show in the future.
[DataMember]
public bool Hideable { get; set; }
Property Value
- bool
Identity
[IgnoreDataMember]
public string Identity { get; set; }
Property Value
- string
InterfaceID
[IgnoreDataMember]
public Guid InterfaceID { get; set; }
Property Value
- Guid
LinkUrl
[DataMember]
public string LinkUrl { get; set; }
Property Value
- string
LogFileName
[IgnoreDataMember]
public string LogFileName { get; set; }
Property Value
- string
MessageCode
The message code that identifies the message.
public string MessageCode { get; protected set; }
Property Value
- string
MessageType
The type of the message.
[DataMember]
public MessageType MessageType { get; protected set; }
Property Value
NumericMessageCode
[IgnoreDataMember]
public int NumericMessageCode { get; }
Property Value
- int
Severity
[IgnoreDataMember]
public MessageType Severity { get; set; }
Property Value
Source
[IgnoreDataMember]
public string Source { get; set; }
Property Value
- string
SourceDescription
A description of the object that generated the message.
[DataMember]
public string SourceDescription { get; set; }
Property Value
- string
SourceField
[IgnoreDataMember]
public string SourceField { get; set; }
Property Value
- string
SourceFile
[IgnoreDataMember]
public string SourceFile { get; set; }
Property Value
- string
SourceIdentity
The identity of the object that generated the message.
[DataMember]
public string SourceIdentity { get; set; }
Property Value
- string
SourceLine
[IgnoreDataMember]
public int SourceLine { get; set; }
Property Value
- int
Text
public string Text { get; }
Property Value
- string
Methods
AddInsert(string)
public void AddInsert(string insert)
Parameters
| Name | Type | Description |
|---|---|---|
insert |
string |
AddVariantInsert(object)
public void AddVariantInsert(object insert)
Parameters
| Name | Type | Description |
|---|---|---|
insert |
object |
AdditionalPropertiesList()
Gets a string list of all additional properties, in the form key: value
public string AdditionalPropertiesList()
Returns
- string
CreateForCode(MessageType, string)
Creates a Message for the specified message code.
public static Message CreateForCode(MessageType type, string code)
Parameters
| Name | Type | Description |
|---|---|---|
type |
MessageType | |
code |
string |
Returns
Remarks
This method can only be used for one of the predefined code values.
The Text for the code is loaded from the resource file.
CreateForText(MessageType, string)
Creates a message for the specified message text
public static Message CreateForText(MessageType type, string messageText)
Parameters
| Name | Type | Description |
|---|---|---|
type |
MessageType | |
messageText |
string |
Returns
Remarks
The MessageCode is set to "ADT000000". To use a custom message code, use CreateForText(MessageType, string, string).
CreateForText(MessageType, string, string)
public static Message CreateForText(MessageType type, string messageText, string messageCode)
Parameters
| Name | Type | Description |
|---|---|---|
type |
MessageType | |
messageText |
string | |
messageCode |
string |
Returns
CreateFromException(MessageType, string, Exception)
public static Message CreateFromException(MessageType severity, string code, Exception ex)
Parameters
| Name | Type | Description |
|---|---|---|
severity |
MessageType | |
code |
string | |
ex |
Exception |
Returns
CreateFromException(MessageType, string, Exception, params object[])
Creates a message from an exception.
public static Message CreateFromException(MessageType severity, string code, Exception ex, params object[] stringReplacements)
Parameters
| Name | Type | Description |
|---|---|---|
severity |
MessageType | |
code |
string | |
ex |
Exception | |
stringReplacements |
object[] |
Returns
Remarks
The code is used to retrieve the error message to use. The message is formatted to replace {0} with ex.Message. Any other placeholders are replaced with the values from the passed array. The DebuggingInformation property of the message is set to ex.ToString().
CreateFromException(string, Exception)
Creates a message from an exception.
public static Message CreateFromException(string code, Exception ex)
Parameters
| Name | Type | Description |
|---|---|---|
code |
string | |
ex |
Exception |
Returns
Remarks
The code is used to retrieve the error message to use. The message is formatted to replace {0} (if present) with ex.Message. The DebuggingInformation property of the message is set to ex.ToString().
CreateUnexpectedError(Exception)
public static Message CreateUnexpectedError(Exception ex)
Parameters
| Name | Type | Description |
|---|---|---|
ex |
Exception |
Returns
CreateWithMessageOverride(MessageType, string, string)
Creates a new Message using the specified message code and message text
public static Message CreateWithMessageOverride(MessageType type, string code, string messageText)
Parameters
| Name | Type | Description |
|---|---|---|
type |
MessageType | |
code |
string | |
messageText |
string |
Returns
Remarks
This method creates a new Message with the specified message code, but sets the Text to the messageText rather than the default string associated with the code.
- See Also
CreateWithMessageOverrideAndReplacements(MessageType, string, string, params object[])
Creates a new Message using the specified message code, resource code, and message text.
public static Message CreateWithMessageOverrideAndReplacements(MessageType type, string code, string messageResourceID, params object[] replacementStrings)
Parameters
| Name | Type | Description |
|---|---|---|
type |
MessageType | |
code |
string | |
messageResourceID |
string | The resource ID for the message text. Must be a resource from the Messages string table. |
replacementStrings |
object[] | Replacement tokens for the message text. |
Returns
- See Also
CreateWithReplacements(MessageType, string, params object[])
Creates a new Message using the specified message code and replacement strings
public static Message CreateWithReplacements(MessageType type, string code, params object[] replacementStrings)
Parameters
| Name | Type | Description |
|---|---|---|
type |
MessageType | |
code |
string | |
replacementStrings |
object[] |
Returns
Remarks
This method uses the message resource string associated with the code, and replaces substitution tokens in the string with the values provided in the replacementStrings (using String.Format).
GetAdditionalProperty(string)
Returns the property with the specified name, or Null if the property does not exist.
public string GetAdditionalProperty(string name)
Parameters
| Name | Type | Description |
|---|---|---|
name |
string |
Returns
- string
GetAdditionalProperty(string, int)
Returns the property with the specified name, or the defaultValue if the property is not defined for this message.
public int GetAdditionalProperty(string name, int defaultValue)
Parameters
| Name | Type | Description |
|---|---|---|
name |
string | The name of the property to get. |
defaultValue |
int | The default value to return if the property does not exist in this message. |
Returns
- int
GetAdditionalProperty(string, string)
Returns the property with the specified name, or the defaultValue if the property is not defined for this message.
public string GetAdditionalProperty(string name, string defaultValue)
Parameters
| Name | Type | Description |
|---|---|---|
name |
string | The name of the property to get. |
defaultValue |
string | The default value to return if the property does not exist in this message. |
Returns
- string
PaddedSeverityDescription(MessageType)
Gets the SeverityDescription, right-padded to the length of the longest severity literal
public static string PaddedSeverityDescription(MessageType severity)
Parameters
| Name | Type | Description |
|---|---|---|
severity |
MessageType |
Returns
- string
SetAdditionalProperty(string, int)
Sets a property for the message.
public void SetAdditionalProperty(string name, int value)
Parameters
| Name | Type | Description |
|---|---|---|
name |
string | |
value |
int |
SetAdditionalProperty(string, string)
Sets a property for the message.
public void SetAdditionalProperty(string name, string value)
Parameters
| Name | Type | Description |
|---|---|---|
name |
string | |
value |
string |
SeverityDescription()
public string SeverityDescription()
Returns
- string
SeverityDescription(MessageType)
public static string SeverityDescription(MessageType severity)
Parameters
| Name | Type | Description |
|---|---|---|
severity |
MessageType |
Returns
- string
ToString()
Returns the message code and message text.
public override string ToString()
Returns
- string
ToString(FormatOptions)
public string ToString(Message.FormatOptions options)
Parameters
| Name | Type | Description |
|---|---|---|
options |
Message.FormatOptions |
Returns
- string