Table of Contents

Class Message

Namespace
ArcanaDevelopment.adTempus.Shared
Assembly
ArcanaDevelopment.adTempus.Shared.dll

Represents an error or other message generated by adTempus

[DataContract]
public class Message
Inheritance
object
Message

Remarks

The Message class is used to convey errors and other messages suitable for presentation to the user

Constructors

Message()

protected Message()

Message(MessageType, string, string)

Creates a message

public Message(MessageType messageType, string messageCode, string messageText)

Parameters

NameTypeDescription
messageType MessageType

The type (severity) of the message

messageCode string

The message code. All messages generated by adTempus use a numeric code with the prefix "ADT". Client application should define their own message codes with a distinct prefix.

messageText string

The text of the message

Properties

AdditionalCode

Additional message or error code associated with some messages

[IgnoreDataMember]
public string AdditionalCode { get; set; }

Property Value

string

AdditionalInformation

Extended information for the message

[IgnoreDataMember]
public string AdditionalInformation { get; set; }

Property Value

string

AdditionalMessages

Additional messages associated with the primary message.

[IgnoreDataMember]
public MessageCollection AdditionalMessages { get; }

Property Value

MessageCollection

Remarks

For example, if the message represents a data validation error for a bulk operation, the AdditionalMessages will contain a message for each specific error.

AdditionalProperties

Additional attributes associated with the message.

[IgnoreDataMember]
public Dictionary<string, string> AdditionalProperties { get; }

Property Value

Dictionary<string, string>

Remarks

The dictionary is case-insensitive.

DebuggingInformation

Additional detailed information that may be useful for debugging

[IgnoreDataMember]
public string DebuggingInformation { get; set; }

Property Value

string

Remarks

Some messages may include extended information, stack traces, log file excerpts, etc.

ExceptionType

If the message is an exception, indicates the type of exception

[DataMember]
public int ExceptionType { get; set; }

Property Value

int

Remarks

If present, the value will be one of the MessageExceptionType values

FormattedMessageCode

Returns the MessageCode with a suffix indicating the ArcanaDevelopment.adTempus.Shared.Message.Severity

[IgnoreDataMember]
public string FormattedMessageCode { get; }

Property Value

string

The MessageCode with a one-letter suffix indicating the ArcanaDevelopment.adTempus.Shared.Message.Severity: D, I, W, O, E, or X.

See Also

HelpContext

The help context associated with the message, if any

[DataMember]
public string HelpContext { get; set; }

Property Value

string

HelpFile

The help file associated with the message, if any

[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

Remarks

There is no built-in mechanism for hiding messages; it is up to the UI to implement this and store the information about which messages have been hidden, and to set and use this property as appropriate.

Hideable

Indicates whether the user is allowed to hide this message so that it is not shown in the future.

[DataMember]
public bool Hideable { get; set; }

Property Value

bool

LinkUrl

A Url the user can visit for more information about the message

[DataMember]
public string LinkUrl { get; set; }

Property Value

string

LogFileName

The name of the log file containing details related to the message

[IgnoreDataMember]
public string LogFileName { get; set; }

Property Value

string

MessageCode

The message code that identifies the message.

[DataMember]
public string MessageCode { get; protected set; }

Property Value

string

Remarks

Nearly all messages are identified by a message code that identifies the message (similar to a compiler error code). This code can be used to search for messages in support resources, etc.

The code is in the form ADTnnnnnn where nnnnnn is a 0-padded integer.

Some ad-hoc messages are issued with the numeric portion set to 000000.

See Also

MessageType

The type of the message.

[DataMember]
public MessageType MessageType { get; }

Property Value

MessageType

NumericMessageCode

Gets the numeric portion of the MessageCode

[IgnoreDataMember]
public int NumericMessageCode { get; }

Property Value

int

SourceDescription

A description of the object that generated the message.

[DataMember]
public string SourceDescription { get; set; }

Property Value

string

Remarks

This property is not always populated and may be null.

SourceField

The name of the field that issued the message, if any

[IgnoreDataMember]
public string SourceField { get; set; }

Property Value

string

SourceIdentity

The identity of the object that generated the message.

[DataMember]
public string SourceIdentity { get; set; }

Property Value

string

Remarks

This property is not always populated and may be null.

Text

Gets the text of the message.

public string Text { get; }

Property Value

string

Remarks

This property contains the text of the message, without the MessageCode. Use one of the ToString() methods to return a string containing both the text and code.

Methods

AdditionalPropertiesList()

Gets a string list of all additional properties, in the form key: value

public string AdditionalPropertiesList()

Returns

string

GetAdditionalProperty(string)

Returns the property with the specified name, or null if the property does not exist.

public string GetAdditionalProperty(string name)

Parameters

NameTypeDescription
name string

The case-insensitive name of the property to get

Returns

string

The requested property, or null if the property does not exist.

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

NameTypeDescription
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

NameTypeDescription
name string

The case-insensitive 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 description of a MessageSeverity, right-padded to the length of the longest severity literal

public static string PaddedSeverityDescription(MessageType severity)

Parameters

NameTypeDescription
severity MessageType

The severity to get the description of

Returns

string

SetAdditionalProperty(string, int)

Sets a property for the message.

public void SetAdditionalProperty(string name, int value)

Parameters

NameTypeDescription
name string

The case-insensitive name of the property to set. If a property with the same name already exists, it is replaced with the new value.

value int

The value for the property

SetAdditionalProperty(string, string)

Sets a property for the message.

public void SetAdditionalProperty(string name, string value)

Parameters

NameTypeDescription
name string

The case-insensitive name of the property to set. If a property with the same name already exists, it is replaced with the new value.

value string

The value for the property

SeverityDescription()

Gets the name of the ArcanaDevelopment.adTempus.Shared.Message.Severity

public string SeverityDescription()

Returns

string

SeverityDescription(MessageType)

Gets the description of a MessageSeverity

public static string SeverityDescription(MessageType severity)

Parameters

NameTypeDescription
severity MessageType

The severity to get the description of

Returns

string

ToString()

Returns the message code and message text.

public override string ToString()

Returns

string

ToString(FormatOptions)

Returns the Message, optionally including the MessageCode in one of various configurations.

public string ToString(Message.FormatOptions options)

Parameters

NameTypeDescription
options Message.FormatOptions

Options specifying how the result should be formatted.

Returns

string