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
- BaseDataList.cs
- TouchesCapturedWithinProperty.cs
- PerspectiveCamera.cs
- BackgroundWorker.cs
- SkinBuilder.cs
- DataGridCellItemAutomationPeer.cs
- StyleXamlParser.cs
- SchemaEntity.cs
- NGCSerializer.cs
- PeerNameRegistration.cs
- XmlWriterSettings.cs
- Query.cs
- ConnectionsZoneAutoFormat.cs
- WebControlAdapter.cs
- AxParameterData.cs
- CompositeFontParser.cs
- CompoundFileStreamReference.cs
- SerializationInfo.cs
- EventSinkHelperWriter.cs
- AccessDataSource.cs
- _ConnectOverlappedAsyncResult.cs
- OdbcInfoMessageEvent.cs
- QilChoice.cs
- RequestCachePolicy.cs
- RoutedUICommand.cs
- DrawingContext.cs
- Ref.cs
- EventDescriptor.cs
- ColorIndependentAnimationStorage.cs
- XmlHelper.cs
- ButtonRenderer.cs
- HttpCapabilitiesEvaluator.cs
- Error.cs
- _DomainName.cs
- AppSettingsReader.cs
- ConfigurationStrings.cs
- Material.cs
- BitmapSource.cs
- ImageList.cs
- OdbcConnectionPoolProviderInfo.cs
- WebSysDescriptionAttribute.cs
- XslException.cs
- SpellerHighlightLayer.cs
- GeneralTransform3D.cs
- DataControlFieldHeaderCell.cs
- ErrorStyle.cs
- DbConvert.cs
- FontStretch.cs
- ButtonColumn.cs
- PasswordTextContainer.cs
- StylusPointCollection.cs
- FilterEventArgs.cs
- ContractCodeDomInfo.cs
- DelegatedStream.cs
- Html32TextWriter.cs
- RoleGroup.cs
- GroupBox.cs
- ListControl.cs
- WebZone.cs
- Timer.cs
- AssertFilter.cs
- TableLayoutPanel.cs
- ObjectSpanRewriter.cs
- Mapping.cs
- DataTransferEventArgs.cs
- CombinedGeometry.cs
- ViewManagerAttribute.cs
- FormViewInsertedEventArgs.cs
- Baml2006Reader.cs
- OdbcReferenceCollection.cs
- ToolStripProgressBar.cs
- ReadOnlyDictionary.cs
- LogicalExpr.cs
- XmlSchemaSimpleTypeRestriction.cs
- RuleProcessor.cs
- HtmlMobileTextWriter.cs
- ListMarkerLine.cs
- PropertyManager.cs
- EntryWrittenEventArgs.cs
- GeneralTransformCollection.cs
- ErrorFormatterPage.cs
- DrawingContextWalker.cs
- HostSecurityManager.cs
- AutomationEvent.cs
- WorkflowTimerService.cs
- DbConnectionFactory.cs
- XPathCompileException.cs
- TouchesCapturedWithinProperty.cs
- RemoteWebConfigurationHost.cs
- WebAdminConfigurationHelper.cs
- EntityDataSourceUtil.cs
- ArrayList.cs
- Clipboard.cs
- MediaEntryAttribute.cs
- ProcessHostFactoryHelper.cs
- UIElement.cs
- HostedController.cs
- ExpressionConverter.cs
- OnOperation.cs
- ToolboxDataAttribute.cs