Open sandboxFocus

Class MessageSource

Provides convenience methods to work with an IMessageSink.

Inheritance
MessageSource
Implements
Namespace: PostSharp.Extensibility
Assembly: PostSharp.dll
Syntax
public class MessageSource : MarshalByRefObject, IMessageSink
Remarks

A message source emits messages whose texts are stored in a single place, an IMessageDispenser or a ResourceManager, and identified by their message identifier. Typically, create one singleton instance for each component, for example in a static field of a class derived from MessageSource, and associate it with a class derived from MessageDispenser. For a few messages, the static Write methods of Message are simpler.

When the dispenser does not know a message identifier, the message text says that no text was found. When a message sink is set, writing a message of severity Fatal throws a MessageException after the message is emitted.

Constructors

Name Description
MessageSource(string, IMessageDispenser)

Initializes a new instance of the MessageSource class backed by a IMessageDispenser.

MessageSource(string, ResourceManager)

Initializes a new instance of the MessageSource class backed by a ResourceManager.

Properties

Name Description
MessageSink

Gets the current message sink.

Methods

Name Description
CreateMessage(MessageLocation, SeverityType, string, Exception, params object[])

Creates a Message from the current MessageSource.

Write(Message)

Writes a message to the sink.

Write(MessageLocation, SeverityType, string, Exception, params object[])

Emits a Message and specifies an inner Exception.

Write(MessageLocation, SeverityType, string, params object[])

Emits a Message.

Write(Assembly, SeverityType, string, params object[])

Emits a Message.

Write(MemberInfo, SeverityType, string, params object[])

Emits a Message.

Write(ParameterInfo, SeverityType, string, params object[])

Emits a Message.

See Also