Code:
/ 4.0 / 4.0 / 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. 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
- XmlAttributeAttribute.cs
- PageCodeDomTreeGenerator.cs
- KeyNotFoundException.cs
- Listen.cs
- ListDependantCardsRequest.cs
- JsonEnumDataContract.cs
- DataGridRow.cs
- SubclassTypeValidatorAttribute.cs
- TextDecorationCollection.cs
- DesignerImageAdapter.cs
- TextSelectionProcessor.cs
- DataContext.cs
- X509SecurityToken.cs
- FullTextLine.cs
- AuthenticationConfig.cs
- MenuEventArgs.cs
- CommandConverter.cs
- IImplicitResourceProvider.cs
- MultiplexingFormatMapping.cs
- IntellisenseTextBox.cs
- MobileContainerDesigner.cs
- _SslSessionsCache.cs
- PhonemeEventArgs.cs
- HatchBrush.cs
- Stackframe.cs
- DocumentViewerAutomationPeer.cs
- Int16Storage.cs
- DependencySource.cs
- SimpleWorkerRequest.cs
- InstanceLockedException.cs
- XmlUnspecifiedAttribute.cs
- MasterPageParser.cs
- ColumnProvider.cs
- PackWebRequest.cs
- SqlBinder.cs
- RenderTargetBitmap.cs
- CredentialManagerDialog.cs
- ToolstripProfessionalRenderer.cs
- MultipleViewPattern.cs
- UpdatePanelTrigger.cs
- BaseResourcesBuildProvider.cs
- RuntimeEnvironment.cs
- ElementUtil.cs
- GridViewDeletedEventArgs.cs
- EllipseGeometry.cs
- OutgoingWebResponseContext.cs
- HostedElements.cs
- EdgeProfileValidation.cs
- DateTimeOffsetConverter.cs
- PropertyTab.cs
- ContainerControl.cs
- DynamicAttribute.cs
- TextDecorationCollectionConverter.cs
- HiddenFieldPageStatePersister.cs
- SoapReflectionImporter.cs
- LocalizationComments.cs
- ToolStripDropDownClosingEventArgs.cs
- UpDownEvent.cs
- ObjectListShowCommandsEventArgs.cs
- ZipFileInfo.cs
- SQLBoolean.cs
- HttpException.cs
- COAUTHINFO.cs
- SqlCacheDependencyDatabase.cs
- IsolatedStorageFilePermission.cs
- MouseActionConverter.cs
- TextTreeUndoUnit.cs
- MediaContext.cs
- UnsafeNativeMethods.cs
- StandardToolWindows.cs
- GiveFeedbackEventArgs.cs
- SerializationInfoEnumerator.cs
- ExplicitDiscriminatorMap.cs
- EventManager.cs
- AxDesigner.cs
- ExceptionHandler.cs
- NoneExcludedImageIndexConverter.cs
- JoinTreeNode.cs
- SafeCryptContextHandle.cs
- PromptEventArgs.cs
- TreePrinter.cs
- GeneratedCodeAttribute.cs
- DropDownList.cs
- WsdlInspector.cs
- XPathDescendantIterator.cs
- FactoryMaker.cs
- CustomAttribute.cs
- LocalizedNameDescriptionPair.cs
- AssemblyResourceLoader.cs
- GridEntry.cs
- HwndSourceKeyboardInputSite.cs
- CaretElement.cs
- AuthorizationRule.cs
- ValidatorCompatibilityHelper.cs
- DataGridViewEditingControlShowingEventArgs.cs
- ViewManager.cs
- SocketManager.cs
- XmlNamedNodeMap.cs
- NetNamedPipeBindingElement.cs
- IndexObject.cs