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
- Rect3DValueSerializer.cs
- ReadingWritingEntityEventArgs.cs
- WebPartManager.cs
- DataGridViewRowPrePaintEventArgs.cs
- ThicknessConverter.cs
- InvokeSchedule.cs
- TextCollapsingProperties.cs
- BitmapImage.cs
- ContextMenuStripGroupCollection.cs
- ComponentEditorForm.cs
- CustomLineCap.cs
- Composition.cs
- Certificate.cs
- CanonicalFontFamilyReference.cs
- PerformanceCounter.cs
- MediaTimeline.cs
- FixedSOMTextRun.cs
- SqlConnectionPoolProviderInfo.cs
- CodeAccessSecurityEngine.cs
- HyperLinkColumn.cs
- QilIterator.cs
- BufferedGraphics.cs
- DataGridState.cs
- SqlDeflator.cs
- Models.cs
- SessionParameter.cs
- MultiTouchSystemGestureLogic.cs
- FontWeight.cs
- Point4D.cs
- ReferentialConstraintRoleElement.cs
- CodeDOMProvider.cs
- NameValueConfigurationElement.cs
- DecoderBestFitFallback.cs
- SyncOperationState.cs
- CancelEventArgs.cs
- AnnotationHighlightLayer.cs
- FrameAutomationPeer.cs
- Animatable.cs
- TextStore.cs
- ListDesigner.cs
- ListViewTableCell.cs
- PropertyFilterAttribute.cs
- WindowPatternIdentifiers.cs
- DefaultBinder.cs
- SelfSignedCertificate.cs
- TimeZone.cs
- WebSysDefaultValueAttribute.cs
- RouteCollection.cs
- ScriptHandlerFactory.cs
- DeviceSpecificDesigner.cs
- _HTTPDateParse.cs
- AtlasWeb.Designer.cs
- PrinterUnitConvert.cs
- FlagsAttribute.cs
- PingReply.cs
- dbenumerator.cs
- AnnotationResource.cs
- HwndPanningFeedback.cs
- ObjectStateFormatter.cs
- WindowsFormsHelpers.cs
- SchemaElementLookUpTableEnumerator.cs
- HttpProfileGroupBase.cs
- HostSecurityManager.cs
- UniqueEventHelper.cs
- DataContractSerializerServiceBehavior.cs
- FixedPageAutomationPeer.cs
- PrintingPermission.cs
- StyleXamlParser.cs
- DesignTimeValidationFeature.cs
- EncoderReplacementFallback.cs
- ToolStripDropDownDesigner.cs
- TraceContextRecord.cs
- ProjectionPath.cs
- AutomationEventArgs.cs
- SignedPkcs7.cs
- BrowserDefinitionCollection.cs
- WebPartHelpVerb.cs
- EmptyEnumerable.cs
- DotExpr.cs
- SamlAuthenticationStatement.cs
- DetailsViewPageEventArgs.cs
- TransportElement.cs
- ScrollItemProviderWrapper.cs
- ScrollChrome.cs
- DataBoundControlHelper.cs
- XmlSchemaAll.cs
- Rotation3D.cs
- OdbcReferenceCollection.cs
- Selector.cs
- GridItemPatternIdentifiers.cs
- SmiRequestExecutor.cs
- XmlArrayAttribute.cs
- ToolStripItemDataObject.cs
- SoapMessage.cs
- CompositeDesignerAccessibleObject.cs
- ScriptDescriptor.cs
- ErrorTolerantObjectWriter.cs
- UnsignedPublishLicense.cs
- SafeLocalAllocation.cs
- MULTI_QI.cs