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
- PropertyDescriptor.cs
- ParentQuery.cs
- CommonObjectSecurity.cs
- DocumentSchemaValidator.cs
- AnonymousIdentificationSection.cs
- SecurityCapabilities.cs
- ExpandSegmentCollection.cs
- ValidationErrorEventArgs.cs
- WebPartAuthorizationEventArgs.cs
- BehaviorEditorPart.cs
- HTTPNotFoundHandler.cs
- SystemResourceHost.cs
- SingleTagSectionHandler.cs
- ProxyGenerationError.cs
- SoapInteropTypes.cs
- RemotingException.cs
- XmlDataDocument.cs
- XsdDataContractImporter.cs
- ComponentConverter.cs
- TextUtf8RawTextWriter.cs
- SrgsDocument.cs
- SmiRequestExecutor.cs
- ToolStripSystemRenderer.cs
- UnSafeCharBuffer.cs
- PointCollectionConverter.cs
- DataServiceKeyAttribute.cs
- ErrorTableItemStyle.cs
- SchemaCollectionCompiler.cs
- ThrowHelper.cs
- EventSinkHelperWriter.cs
- DataGridViewSelectedColumnCollection.cs
- AddingNewEventArgs.cs
- WindowsToolbarItemAsMenuItem.cs
- DataServiceRequestOfT.cs
- DbgCompiler.cs
- SimpleApplicationHost.cs
- ColumnReorderedEventArgs.cs
- DefaultAsyncDataDispatcher.cs
- XmlSchemaDatatype.cs
- FlowLayoutPanel.cs
- SplineKeyFrames.cs
- _OSSOCK.cs
- SmtpCommands.cs
- ThreadStaticAttribute.cs
- SmiEventSink.cs
- SqlGatherProducedAliases.cs
- ItemsChangedEventArgs.cs
- ExtensionFile.cs
- TraceHandler.cs
- FileUtil.cs
- TrackingSection.cs
- SelectionPattern.cs
- FamilyTypeface.cs
- WebCodeGenerator.cs
- HttpProfileGroupBase.cs
- safex509handles.cs
- _SingleItemRequestCache.cs
- Mutex.cs
- LinkLabelLinkClickedEvent.cs
- FileLoadException.cs
- FullTrustAssemblyCollection.cs
- TextCollapsingProperties.cs
- Binding.cs
- EventLogSession.cs
- QuotaThrottle.cs
- SamlAuthorizationDecisionClaimResource.cs
- PrivilegeNotHeldException.cs
- LineVisual.cs
- DigestTraceRecordHelper.cs
- AspNetHostingPermission.cs
- PropertyTab.cs
- SqlNodeTypeOperators.cs
- WebScriptMetadataMessage.cs
- HashMembershipCondition.cs
- XamlSerializer.cs
- ToolStripItemDataObject.cs
- HtmlTitle.cs
- XamlRtfConverter.cs
- SmtpNtlmAuthenticationModule.cs
- SchemaMerger.cs
- BackStopAuthenticationModule.cs
- Line.cs
- HttpException.cs
- WebEventTraceProvider.cs
- XmlNamespaceMappingCollection.cs
- MenuItem.cs
- GroupLabel.cs
- RIPEMD160.cs
- ResumeStoryboard.cs
- ZipPackagePart.cs
- FixedSOMPageConstructor.cs
- MessageParameterAttribute.cs
- AlignmentYValidation.cs
- ConfigXmlAttribute.cs
- StringUtil.cs
- HotSpotCollection.cs
- ObjectList.cs
- UpdateException.cs
- ItemsPresenter.cs
- RootBrowserWindow.cs