Export (0) Print
Expand All

Message.IsFirstInTransaction Property

Gets a value that indicates whether the message was the first message sent in a transaction.

Namespace:  System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

[MessagingDescriptionAttribute("MsgIsFirstInTransaction")]
public bool IsFirstInTransaction { get; }

Property Value

Type: System.Boolean
true if the message was the first message sent in a transaction; otherwise, false.

ExceptionCondition
InvalidOperationException

The message has not been sent. This property can only be read on messages retrieved from a queue.

-or-

The message queue is filtered to ignore the IsFirstInTransaction property.

Receiving applications use the IsFirstInTransaction property to verify that a message was the first message sent in a single transaction to a single queue.

This property is available only with Message Queuing version 2.0 and later.

To verify transaction boundaries, you can use the IsFirstInTransaction property along with two other properties: IsLastInTransaction and TransactionId. Use the former to check whether a message was the last message sent in the transaction, and use the latter to retrieve the identifier of the transaction.

If only one message is sent in a transaction, the IsFirstInTransaction and IsLastInTransaction properties are both set to true.

The following code example displays the value of a message's IsFirstInTransaction property.

// Display the value of the message's IsFirstInTransaction property. 
// To view this property value, the queue's 
// MessageReadPropertyFilter.IsFirstInTransaction property must be set 
// to true before the message is received.
Console.WriteLine("Message.IsFirstInTransaction: {0}",
    orderMessage.IsFirstInTransaction);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft