Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities.DurableInstancing / System / Activities / DurableInstancing / CorrelationKey.cs / 1305376 / CorrelationKey.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Activities.DurableInstancing
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
using System.Runtime.DurableInstancing;
sealed class CorrelationKey
{
public CorrelationKey(Guid keyId)
: this(keyId, null, InstanceEncodingOption.None)
{
}
public CorrelationKey(Guid keyId, IDictionary keyMetadata, InstanceEncodingOption encodingOption)
{
this.KeyId = keyId;
this.BinaryData = SerializationUtilities.SerializeKeyMetadata(keyMetadata, encodingOption);
}
public Guid KeyId
{
get;
set;
}
public long StartPosition
{
get;
set;
}
public ArraySegment BinaryData
{
get;
set;
}
public void SerializeToXmlElement(XmlWriter xmlWriter)
{
xmlWriter.WriteStartElement("CorrelationKey");
xmlWriter.WriteAttributeString("KeyId", this.KeyId.ToString());
if (this.BinaryData.Array != null)
{
xmlWriter.WriteAttributeString("StartPosition", this.StartPosition.ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteAttributeString("BinaryLength", this.BinaryData.Count.ToString(CultureInfo.InvariantCulture));
}
xmlWriter.WriteEndElement();
}
public static List BuildKeyList(ICollection keys)
{
List result = null;
if (keys != null)
{
result = new List(keys.Count);
foreach (Guid guid in keys)
{
result.Add(new CorrelationKey(guid));
}
}
else
{
result = new List();
}
return result;
}
public static List BuildKeyList(IDictionary> keys, InstanceEncodingOption encodingOption)
{
List result = new List();
if (keys != null)
{
foreach (KeyValuePair> keyValuePair in keys)
{
result.Add(new CorrelationKey(keyValuePair.Key, keyValuePair.Value, encodingOption));
}
}
return result;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Literal.cs
- Base64Decoder.cs
- ChtmlTextWriter.cs
- CallbackValidator.cs
- BaseCollection.cs
- BoundsDrawingContextWalker.cs
- DirectoryObjectSecurity.cs
- CheckBoxStandardAdapter.cs
- ActiveDesignSurfaceEvent.cs
- RangeValuePattern.cs
- _ListenerResponseStream.cs
- PageAsyncTaskManager.cs
- ChangeBlockUndoRecord.cs
- WebPartManager.cs
- Operand.cs
- InfoCardRSACryptoProvider.cs
- bidPrivateBase.cs
- TextSelectionHighlightLayer.cs
- PeerFlooder.cs
- KernelTypeValidation.cs
- SchemaElementDecl.cs
- TypeForwardedToAttribute.cs
- StringValidator.cs
- CorePropertiesFilter.cs
- ReadWriteObjectLock.cs
- ContextStack.cs
- IIS7UserPrincipal.cs
- TokenBasedSet.cs
- DataServiceResponse.cs
- TransactionManager.cs
- DataGridViewLinkCell.cs
- SynchronizedPool.cs
- ScrollEvent.cs
- TrackingProfileCache.cs
- TransactionScopeDesigner.cs
- OdbcCommandBuilder.cs
- DataControlPagerLinkButton.cs
- TrustManager.cs
- ResetableIterator.cs
- ExpressionPrefixAttribute.cs
- DelayedRegex.cs
- HtmlInputHidden.cs
- ToolStrip.cs
- DiffuseMaterial.cs
- SettingsContext.cs
- TableLayoutStyle.cs
- CatalogZoneBase.cs
- UnaryQueryOperator.cs
- UserMapPath.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- IWorkflowDebuggerService.cs
- CancellationState.cs
- cookieexception.cs
- ChangePassword.cs
- WorkflowServiceBehavior.cs
- MatrixTransform3D.cs
- FontResourceCache.cs
- TraversalRequest.cs
- ButtonChrome.cs
- CustomBindingElementCollection.cs
- SplashScreen.cs
- FloaterBaseParagraph.cs
- XmlSchemaGroupRef.cs
- NativeDirectoryServicesQueryAPIs.cs
- basecomparevalidator.cs
- GregorianCalendarHelper.cs
- GeneratedContractType.cs
- DbParameterCollectionHelper.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- StylusShape.cs
- CheckoutException.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- Rfc2898DeriveBytes.cs
- dataprotectionpermission.cs
- BitmapMetadataEnumerator.cs
- GuidelineCollection.cs
- IsolatedStorage.cs
- PerspectiveCamera.cs
- DelegateSerializationHolder.cs
- BuildResult.cs
- ProviderBase.cs
- ScaleTransform.cs
- DesignTimeTemplateParser.cs
- AppearanceEditorPart.cs
- ServiceMemoryGates.cs
- HttpConfigurationContext.cs
- XPathSelectionIterator.cs
- XhtmlBasicTextBoxAdapter.cs
- ErrorBehavior.cs
- Ops.cs
- ProfileInfo.cs
- TableLayoutSettingsTypeConverter.cs
- GlobalProxySelection.cs
- IPGlobalProperties.cs
- ColumnMapVisitor.cs
- ResourceCodeDomSerializer.cs
- AspNetCompatibilityRequirementsMode.cs
- VoiceObjectToken.cs
- CachingParameterInspector.cs
- BamlRecords.cs