Table of Contents

Class Message

Namespace
ArcanaDevelopment.adTempus.Shared
Assembly
ArcanaDevelopment.adTempus.Shared.dll
[DataContract]
public class Message
Inheritance
object
Message

Constructors

Message()

protected Message()

Message(MessageType, string)

Creates a Message for the specified message code.

public Message(MessageType type, string code)

Parameters

NameTypeDescription
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

MessageCollection

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

MessageType

NumericMessageCode

[IgnoreDataMember]
public int NumericMessageCode { get; }

Property Value

int

Severity

[IgnoreDataMember]
public MessageType Severity { get; set; }

Property Value

MessageType

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

NameTypeDescription
insert string

AddVariantInsert(object)

public void AddVariantInsert(object insert)

Parameters

NameTypeDescription
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

NameTypeDescription
type MessageType
code string

Returns

Message

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

NameTypeDescription
type MessageType
messageText string

Returns

Message

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

NameTypeDescription
type MessageType
messageText string
messageCode string

Returns

Message

CreateFromException(MessageType, string, Exception)

public static Message CreateFromException(MessageType severity, string code, Exception ex)

Parameters

NameTypeDescription
severity MessageType
code string
ex Exception

Returns

Message

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

NameTypeDescription
severity MessageType
code string
ex Exception
stringReplacements object[]

Returns

Message

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

NameTypeDescription
code string
ex Exception

Returns

Message

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

NameTypeDescription
ex Exception

Returns

Message

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

NameTypeDescription
type MessageType
code string
messageText string

Returns

Message

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

NameTypeDescription
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

Message
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

NameTypeDescription
type MessageType
code string
replacementStrings object[]

Returns

Message

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

NameTypeDescription
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

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 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

NameTypeDescription
severity MessageType

Returns

string

SetAdditionalProperty(string, int)

Sets a property for the message.

public void SetAdditionalProperty(string name, int value)

Parameters

NameTypeDescription
name string
value int

SetAdditionalProperty(string, string)

Sets a property for the message.

public void SetAdditionalProperty(string name, string value)

Parameters

NameTypeDescription
name string
value string

SeverityDescription()

public string SeverityDescription()

Returns

string

SeverityDescription(MessageType)

public static string SeverityDescription(MessageType severity)

Parameters

NameTypeDescription
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

NameTypeDescription
options Message.FormatOptions

Returns

string