Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / tx / System / Transactions / EnlistmentTraceIdentifier.cs / 1305376 / EnlistmentTraceIdentifier.cs
using System;
namespace System.Transactions
{
///
/// This identifier is used in tracing to distiguish transaction
/// enlistments. This identifier is only unique within
/// a given AppDomain.
///
internal struct EnlistmentTraceIdentifier
{
public static readonly EnlistmentTraceIdentifier Empty = new EnlistmentTraceIdentifier();
public EnlistmentTraceIdentifier(
Guid resourceManagerIdentifier,
TransactionTraceIdentifier transactionTraceId,
int enlistmentIdentifier
)
{
this.resourceManagerIdentifier = resourceManagerIdentifier;
this.transactionTraceIdentifier = transactionTraceId;
this.enlistmentIdentifier = enlistmentIdentifier;
}
private Guid resourceManagerIdentifier;
///
/// The Guid identifier of the resource manager that made the
/// enlistment. If the enlistment is a Volatile enlistment,
/// this value will be Guid.Empty.
///
public Guid ResourceManagerIdentifier
{
get
{
return this.resourceManagerIdentifier;
}
}
private TransactionTraceIdentifier transactionTraceIdentifier;
///
/// The TransactionTraceIdentifier for the transaction that is
/// enlisted upon.
///
public TransactionTraceIdentifier TransactionTraceId
{
get
{
return this.transactionTraceIdentifier;
}
}
private int enlistmentIdentifier;
///
/// A value that distiguishes between multiple enlistments on the same
/// transaction instance by the same resource manager.
///
public int EnlistmentIdentifier
{
get
{
return this.enlistmentIdentifier;
}
}
public override int GetHashCode()
{
return base.GetHashCode(); // Don't have anything better to do.
}
public override bool Equals ( object objectToCompare )
{
if ( ! ( objectToCompare is EnlistmentTraceIdentifier ) )
{
return false;
}
EnlistmentTraceIdentifier id = ( EnlistmentTraceIdentifier )objectToCompare;
if ( (id.ResourceManagerIdentifier != this.ResourceManagerIdentifier ) ||
( id.TransactionTraceId != this.TransactionTraceId ) ||
( id.EnlistmentIdentifier != this.EnlistmentIdentifier ) )
{
return false;
}
return true;
}
public static bool operator==( EnlistmentTraceIdentifier id1, EnlistmentTraceIdentifier id2 )
{
return id1.Equals( id2 );
}
// We need to equality operator and the compiler doesn't let us have an equality operator without an inequality operator,
// so we added it and FXCop doesn't like the fact that we don't call it.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public static bool operator!=( EnlistmentTraceIdentifier id1, EnlistmentTraceIdentifier id2 )
{
return !id1.Equals( id2 );
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
namespace System.Transactions
{
///
/// This identifier is used in tracing to distiguish transaction
/// enlistments. This identifier is only unique within
/// a given AppDomain.
///
internal struct EnlistmentTraceIdentifier
{
public static readonly EnlistmentTraceIdentifier Empty = new EnlistmentTraceIdentifier();
public EnlistmentTraceIdentifier(
Guid resourceManagerIdentifier,
TransactionTraceIdentifier transactionTraceId,
int enlistmentIdentifier
)
{
this.resourceManagerIdentifier = resourceManagerIdentifier;
this.transactionTraceIdentifier = transactionTraceId;
this.enlistmentIdentifier = enlistmentIdentifier;
}
private Guid resourceManagerIdentifier;
///
/// The Guid identifier of the resource manager that made the
/// enlistment. If the enlistment is a Volatile enlistment,
/// this value will be Guid.Empty.
///
public Guid ResourceManagerIdentifier
{
get
{
return this.resourceManagerIdentifier;
}
}
private TransactionTraceIdentifier transactionTraceIdentifier;
///
/// The TransactionTraceIdentifier for the transaction that is
/// enlisted upon.
///
public TransactionTraceIdentifier TransactionTraceId
{
get
{
return this.transactionTraceIdentifier;
}
}
private int enlistmentIdentifier;
///
/// A value that distiguishes between multiple enlistments on the same
/// transaction instance by the same resource manager.
///
public int EnlistmentIdentifier
{
get
{
return this.enlistmentIdentifier;
}
}
public override int GetHashCode()
{
return base.GetHashCode(); // Don't have anything better to do.
}
public override bool Equals ( object objectToCompare )
{
if ( ! ( objectToCompare is EnlistmentTraceIdentifier ) )
{
return false;
}
EnlistmentTraceIdentifier id = ( EnlistmentTraceIdentifier )objectToCompare;
if ( (id.ResourceManagerIdentifier != this.ResourceManagerIdentifier ) ||
( id.TransactionTraceId != this.TransactionTraceId ) ||
( id.EnlistmentIdentifier != this.EnlistmentIdentifier ) )
{
return false;
}
return true;
}
public static bool operator==( EnlistmentTraceIdentifier id1, EnlistmentTraceIdentifier id2 )
{
return id1.Equals( id2 );
}
// We need to equality operator and the compiler doesn't let us have an equality operator without an inequality operator,
// so we added it and FXCop doesn't like the fact that we don't call it.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public static bool operator!=( EnlistmentTraceIdentifier id1, EnlistmentTraceIdentifier id2 )
{
return !id1.Equals( id2 );
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlNodeAnnotation.cs
- cache.cs
- XmlHierarchicalEnumerable.cs
- FormViewUpdatedEventArgs.cs
- MetafileHeaderWmf.cs
- LOSFormatter.cs
- ScriptReferenceBase.cs
- DrawListViewSubItemEventArgs.cs
- LineInfo.cs
- GregorianCalendar.cs
- EventArgs.cs
- XslNumber.cs
- DynamicQueryableWrapper.cs
- ConditionalBranch.cs
- XmlChildEnumerator.cs
- ProfileSection.cs
- RepeaterItemEventArgs.cs
- Point.cs
- ColorIndependentAnimationStorage.cs
- CommandValueSerializer.cs
- WebBrowserSiteBase.cs
- WebPartsPersonalization.cs
- EventLogTraceListener.cs
- PerformanceCounterPermissionEntry.cs
- RectangleF.cs
- CodeTypeDelegate.cs
- QilGeneratorEnv.cs
- UriScheme.cs
- Point3DValueSerializer.cs
- SessionStateSection.cs
- EventRouteFactory.cs
- TCEAdapterGenerator.cs
- MissingFieldException.cs
- AsyncResult.cs
- NameValuePair.cs
- MouseCaptureWithinProperty.cs
- TableLayoutStyle.cs
- ZipIOExtraField.cs
- NavigationService.cs
- ReadOnlyPropertyMetadata.cs
- HelpEvent.cs
- TextBoxAutoCompleteSourceConverter.cs
- MTConfigUtil.cs
- KeyValuePair.cs
- ProtocolElement.cs
- FrugalList.cs
- WmlFormAdapter.cs
- RIPEMD160Managed.cs
- Transactions.cs
- TabItemWrapperAutomationPeer.cs
- BitmapPalettes.cs
- SecurityDescriptor.cs
- TypeBuilder.cs
- DiscardableAttribute.cs
- DataControlField.cs
- Image.cs
- IndexerNameAttribute.cs
- CodeCommentStatementCollection.cs
- CursorInteropHelper.cs
- BufferedResponseStream.cs
- SerializationTrace.cs
- LogExtent.cs
- SynchronizedDispatch.cs
- XamlFilter.cs
- ObjectCacheSettings.cs
- DbConnectionPool.cs
- XmlDocumentFragment.cs
- SHA256Cng.cs
- IPEndPoint.cs
- DataTransferEventArgs.cs
- MergeFilterQuery.cs
- XmlSchemaSequence.cs
- CustomExpressionEventArgs.cs
- securitymgrsite.cs
- SelectedDatesCollection.cs
- DataGridTextBoxColumn.cs
- ProgressBarAutomationPeer.cs
- PersonalizableAttribute.cs
- SystemInfo.cs
- Keyboard.cs
- RootBrowserWindowProxy.cs
- PopupControlService.cs
- RegexGroup.cs
- FeatureSupport.cs
- BindingOperations.cs
- DeadCharTextComposition.cs
- EditorZone.cs
- TextEditorDragDrop.cs
- DropShadowBitmapEffect.cs
- _SecureChannel.cs
- ToolBarButtonDesigner.cs
- SetState.cs
- StreamGeometry.cs
- SpeechUI.cs
- SoapElementAttribute.cs
- BooleanStorage.cs
- Control.cs
- HijriCalendar.cs
- PageCatalogPart.cs
- FromReply.cs