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
- ToggleButton.cs
- StrokeRenderer.cs
- Encoder.cs
- Certificate.cs
- ScriptModule.cs
- DockingAttribute.cs
- IntegerValidator.cs
- Int16.cs
- TextStore.cs
- ColumnMapCopier.cs
- DataGridViewRowsRemovedEventArgs.cs
- ObservableCollection.cs
- Button.cs
- LowerCaseStringConverter.cs
- AuthorizationRule.cs
- DiffuseMaterial.cs
- httpserverutility.cs
- PropVariant.cs
- KerberosSecurityTokenAuthenticator.cs
- Clause.cs
- AlphabetConverter.cs
- ConfigurationErrorsException.cs
- ProgressiveCrcCalculatingStream.cs
- HttpHandlerAction.cs
- MetadataUtilsSmi.cs
- FixedFlowMap.cs
- StringHelper.cs
- LocatorPartList.cs
- SqlMetaData.cs
- Helper.cs
- HMACSHA1.cs
- AbstractExpressions.cs
- PropertyKey.cs
- HierarchicalDataSourceControl.cs
- FormattedText.cs
- MachineKeySection.cs
- XsdDateTime.cs
- PointAnimation.cs
- SHA256Managed.cs
- PropertyEmitter.cs
- Attributes.cs
- RulePatternOps.cs
- Int16Animation.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- XmlSchemaException.cs
- PersonalizationProviderHelper.cs
- TypeBuilderInstantiation.cs
- SpellerError.cs
- PaintValueEventArgs.cs
- SerializerProvider.cs
- SymDocumentType.cs
- DataRecordObjectView.cs
- InvokePattern.cs
- EventLogTraceListener.cs
- TransferRequestHandler.cs
- ItemCheckedEvent.cs
- SchemaType.cs
- TransportContext.cs
- SimpleBitVector32.cs
- ComplexBindingPropertiesAttribute.cs
- IncrementalHitTester.cs
- UdpMessageProperty.cs
- TreeView.cs
- Expr.cs
- Literal.cs
- GridViewDeletedEventArgs.cs
- SyndicationItem.cs
- ResXDataNode.cs
- Decorator.cs
- WebPartEditVerb.cs
- UpdateTracker.cs
- ResponseBodyWriter.cs
- adornercollection.cs
- SqlXmlStorage.cs
- SecurityTokenInclusionMode.cs
- FilteredAttributeCollection.cs
- LocatorPart.cs
- ImageBrush.cs
- SoapHeaders.cs
- DataColumnCollection.cs
- XmlIgnoreAttribute.cs
- X509Utils.cs
- SystemInformation.cs
- CallbackValidatorAttribute.cs
- ActivityFunc.cs
- SortedSetDebugView.cs
- SqlMultiplexer.cs
- ObjectQuery.cs
- ReadOnlyDataSource.cs
- EntityContainerAssociationSetEnd.cs
- WebPartUtil.cs
- StrongNameMembershipCondition.cs
- WarningException.cs
- _ConnectStream.cs
- MobileContainerDesigner.cs
- EdmRelationshipRoleAttribute.cs
- SerializationEventsCache.cs
- D3DImage.cs
- DataGridAddNewRow.cs
- GlobalizationSection.cs