Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / RunTime / DebugEngine / IInstanceTable.cs / 1305376 / IInstanceTable.cs
// Copyright (c) Microsoft Corp., 2004. All rights reserved. #region Using directives using System; using System.Workflow.Runtime; using System.Collections.Generic; using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Design; #endregion namespace System.Workflow.Runtime.DebugEngine { // // IMPORTANT: Do not edit this file without consulting Break Safe Synchronization.doc! // #region interface IInstanceTable public interface IInstanceTable { Activity GetActivity(string instanceId, string activityName); } #endregion #region Class InstanceData internal sealed class InstanceData: ICloneable { Activity rootActivity; public Activity RootActivity { get { return this.rootActivity; } set { this.rootActivity = value; } } public InstanceData(Activity rootActivity) { this.rootActivity = rootActivity; } object ICloneable.Clone() { InstanceData instanceData = new InstanceData(this.rootActivity); return instanceData; } } internal sealed class InstanceMap : Dictionary, ICloneable { object ICloneable.Clone() { InstanceMap data = new InstanceMap(); foreach (Guid instsanceId in Keys) data.Add(instsanceId, (InstanceData) (((ICloneable)(this[instsanceId])).Clone())); return data; } } #endregion #region Class InstanceTable internal sealed class InstanceTable : BreakSafeBase , IInstanceTable { public InstanceTable(int controllerManagedThreadId): base(controllerManagedThreadId) { } // Controller invoked. public void AddInstance(Guid instanceId, Activity rootActivity) { try { Lock(); InstanceMap instanceMap = GetWriterData(); instanceMap[instanceId] = new InstanceData(rootActivity); SaveData(instanceMap); } finally { Unlock(); } } // Controller invoked. public void RemoveInstance(Guid instanceId) { try { Lock(); InstanceMap instanceMap = GetWriterData(); instanceMap.Remove(instanceId); SaveData(instanceMap); } finally { Unlock(); } } // Controller invoked during Dynamic Update notification subscription changes. public Activity GetRootActivity(Guid instanceId) { try { Lock(); return GetReaderData()[instanceId].RootActivity; } finally { Unlock(); } } // Controller invoked during Dynamic Update notification subscription changes. public void UpdateRootActivity(Guid instanceId, Activity rootActivity) { try { Lock(); InstanceMap instanceMap = GetWriterData(); instanceMap[instanceId].RootActivity = rootActivity; SaveData(instanceMap); } finally { Unlock(); } } // DE invoked for watches through expression evaluation. Activity IInstanceTable.GetActivity(string instanceId, string activityQualifiedName) { try { Lock(); Activity rootActivity = GetReaderData()[new Guid(instanceId)].RootActivity; return DebuggerHelpers.ParseActivity(rootActivity, activityQualifiedName); } finally { Unlock(); } } } #endregion } // 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
- ReferenceAssemblyAttribute.cs
- AssemblyFilter.cs
- ProjectionQueryOptionExpression.cs
- ProcessHostFactoryHelper.cs
- References.cs
- SamlAudienceRestrictionCondition.cs
- MSHTMLHost.cs
- GridSplitter.cs
- WindowsToolbarItemAsMenuItem.cs
- UInt64.cs
- ProcessModuleCollection.cs
- ToolStripActionList.cs
- COMException.cs
- SafeNativeMethods.cs
- SqlVisitor.cs
- SqlCacheDependencyDatabaseCollection.cs
- XmlTextReaderImpl.cs
- ElapsedEventArgs.cs
- GlyphTypeface.cs
- ItemCheckEvent.cs
- TextWriterTraceListener.cs
- ScrollChrome.cs
- KeyMatchBuilder.cs
- OracleCommandBuilder.cs
- LinearQuaternionKeyFrame.cs
- FtpCachePolicyElement.cs
- ReliableMessagingHelpers.cs
- ZipIOModeEnforcingStream.cs
- HeaderLabel.cs
- DebugView.cs
- BitSet.cs
- XPathItem.cs
- DataObjectSettingDataEventArgs.cs
- UnsafeNativeMethodsTablet.cs
- SqlCharStream.cs
- ActivationServices.cs
- ColumnMapTranslator.cs
- EpmTargetTree.cs
- TrackingMemoryStreamFactory.cs
- ThreadStartException.cs
- PageBuildProvider.cs
- OLEDB_Util.cs
- MemberListBinding.cs
- WebServiceParameterData.cs
- AndCondition.cs
- ColorConverter.cs
- FormatterConverter.cs
- BamlWriter.cs
- FixedElement.cs
- SessionState.cs
- NTAccount.cs
- StaticSiteMapProvider.cs
- BuildResult.cs
- DbCommandTree.cs
- SlipBehavior.cs
- FrameworkElementFactory.cs
- ScrollPattern.cs
- PublisherIdentityPermission.cs
- Decorator.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- HTTPNotFoundHandler.cs
- CodeMemberField.cs
- recordstate.cs
- Subset.cs
- WebPartDescription.cs
- QilXmlWriter.cs
- InternalSafeNativeMethods.cs
- FatalException.cs
- OdbcParameter.cs
- Setter.cs
- SqlBuilder.cs
- SystemInfo.cs
- ExtenderProvidedPropertyAttribute.cs
- XmlSerializerNamespaces.cs
- PrintPreviewGraphics.cs
- DetailsViewCommandEventArgs.cs
- BindingMemberInfo.cs
- SiteOfOriginPart.cs
- TcpClientCredentialType.cs
- BindingMAnagerBase.cs
- DescendentsWalkerBase.cs
- DataRecordInfo.cs
- WebConfigurationFileMap.cs
- Transactions.cs
- StorageMappingItemCollection.cs
- GridViewDeleteEventArgs.cs
- Msec.cs
- GB18030Encoding.cs
- FixedPageAutomationPeer.cs
- DataServiceEntityAttribute.cs
- InternalSafeNativeMethods.cs
- XmlSchemaSequence.cs
- CurrencyManager.cs
- RelationshipWrapper.cs
- DbParameterCollection.cs
- Visitor.cs
- DBSchemaRow.cs
- errorpatternmatcher.cs
- Renderer.cs
- AsyncOperationManager.cs