Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Serializer / ActivityCodeDomReferenceService.cs / 1305376 / ActivityCodeDomReferenceService.cs
namespace System.Workflow.ComponentModel.Serialization { using System; using System.CodeDom; using System.ComponentModel; using System.ComponentModel.Design; using System.ComponentModel.Design.Serialization; using System.Collections; using System.Resources; using System.Workflow.ComponentModel.Design; using System.Collections.Generic; using Microsoft.CSharp; using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Compiler; using System.CodeDom.Compiler; using System.IO; using System.Reflection; using System.Diagnostics; #region Class ActivityCodeDomReferenceService ////// This class implements the IReferenceService interface and overrides the GetName /// method of the wrapped IReferenceService. /// ////// The CodeDomSerializer in System.Design uses the IReferenceService to generate an /// id for all code variables it create during serialization. By default, the GetName /// method ends up returning the QualifiedName property of an Activity, and since that /// property always contains a '.', it is an invalid variable id. This class overrides /// the GetName method to return a valid name in the case of an Activity class. /// internal sealed class ActivityCodeDomReferenceService : IReferenceService { private IReferenceService refService; public ActivityCodeDomReferenceService(IReferenceService referenceService) { this.refService = referenceService; } public object[] GetReferences(System.Type baseType) { if (refService != null) return refService.GetReferences(baseType); return null; } public object[] GetReferences() { if (refService != null) return refService.GetReferences(); return null; } public System.ComponentModel.IComponent GetComponent(object reference) { if (refService != null) return refService.GetComponent(reference); return null; } public object GetReference(string name) { if (refService != null) return refService.GetReference(name); return null; } public string GetName(object reference) { // If the object is an activity, generate a name of_ , since // the default result of GetName is the activity's QualifiedName, which includes a '.' Activity a = reference as Activity; if (a != null) return a.QualifiedName.Replace('.', '_'); if (refService != null) return refService.GetName(reference); return null; } } #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
- Assembly.cs
- SmiEventStream.cs
- MULTI_QI.cs
- OverflowException.cs
- PartialCachingControl.cs
- PartBasedPackageProperties.cs
- EntityContainerEmitter.cs
- WmpBitmapEncoder.cs
- ValidationHelpers.cs
- Identifier.cs
- DtrList.cs
- WindowsScrollBar.cs
- NonParentingControl.cs
- SessionStateUtil.cs
- CSharpCodeProvider.cs
- ProtocolInformationReader.cs
- SplayTreeNode.cs
- DataGridViewTopRowAccessibleObject.cs
- SoapFormatExtensions.cs
- MetaType.cs
- MultiSelector.cs
- AesManaged.cs
- SoapReflectionImporter.cs
- WindowsContainer.cs
- Add.cs
- WindowsSolidBrush.cs
- DefaultBinder.cs
- ImplicitInputBrush.cs
- ContextMenuService.cs
- TypeUtils.cs
- TargetControlTypeCache.cs
- SafeFileMapViewHandle.cs
- LocalFileSettingsProvider.cs
- DataObject.cs
- CommandConverter.cs
- DBConcurrencyException.cs
- ActiveXSite.cs
- Base64Stream.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- BorderGapMaskConverter.cs
- RuleRefElement.cs
- DataGridViewRowCancelEventArgs.cs
- UnmanagedMemoryStreamWrapper.cs
- SecurityRuntime.cs
- BaseCAMarshaler.cs
- UIElementIsland.cs
- OleDbTransaction.cs
- HandleRef.cs
- ExpressionBuilderCollection.cs
- ArgumentNullException.cs
- EventDescriptor.cs
- TargetConverter.cs
- ClockController.cs
- WorkflowDefinitionDispenser.cs
- WebRequest.cs
- NavigationService.cs
- ScriptingSectionGroup.cs
- XmlSchemaAttributeGroupRef.cs
- FrameworkPropertyMetadata.cs
- RepeatBehaviorConverter.cs
- EventHandlersStore.cs
- TableCellCollection.cs
- LineServices.cs
- DependentList.cs
- Matrix3D.cs
- DesignerRegionCollection.cs
- ConfigurationSectionGroupCollection.cs
- FormatException.cs
- DataGridViewCellFormattingEventArgs.cs
- HtmlControl.cs
- Tokenizer.cs
- CodeDelegateCreateExpression.cs
- LoadGrammarCompletedEventArgs.cs
- RepeaterItemCollection.cs
- DiscoveryClientRequestChannel.cs
- MarshalByValueComponent.cs
- CodeValidator.cs
- HwndHost.cs
- SqlClientFactory.cs
- MailSettingsSection.cs
- Choices.cs
- AVElementHelper.cs
- CheckedListBox.cs
- XmlCharType.cs
- Timer.cs
- Compiler.cs
- OpacityConverter.cs
- TextEditorTyping.cs
- PreparingEnlistment.cs
- TransformerTypeCollection.cs
- SimpleMailWebEventProvider.cs
- ListenerElementsCollection.cs
- TargetException.cs
- CompressedStack.cs
- ObjectSet.cs
- WebPartCatalogAddVerb.cs
- PriorityQueue.cs
- PrinterUnitConvert.cs
- MenuCommand.cs
- UnsafeNativeMethods.cs