Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / IDataContractSurrogate.cs / 1 / IDataContractSurrogate.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Runtime.Serialization { using System; using System.CodeDom; using System.Reflection; using System.Collections.ObjectModel; public interface IDataContractSurrogate { Type GetDataContractType(Type type); object GetObjectToSerialize(object obj, Type targetType); object GetDeserializedObject(object obj, Type targetType); object GetCustomDataToExport(MemberInfo memberInfo, Type dataContractType); object GetCustomDataToExport(Type clrType, Type dataContractType); void GetKnownCustomDataTypes(CollectioncustomDataTypes); Type GetReferencedTypeOnImport(string typeName, string typeNamespace, object customData); CodeTypeDeclaration ProcessImportedType(CodeTypeDeclaration typeDeclaration, CodeCompileUnit compileUnit); } static class DataContractSurrogateCaller { internal static Type GetDataContractType(IDataContractSurrogate surrogate, Type type) { if (DataContract.GetBuiltInDataContract(type)!= null) return type; Type dcType = surrogate.GetDataContractType(type); if(dcType == null) return type; return dcType; } internal static object GetObjectToSerialize(IDataContractSurrogate surrogate, object obj, Type objType, Type membertype) { if(obj == null) return null; if (DataContract.GetBuiltInDataContract(objType)!= null) return obj; return surrogate.GetObjectToSerialize(obj, membertype); } internal static object GetDeserializedObject(IDataContractSurrogate surrogate, object obj, Type objType, Type memberType) { if(obj == null) return null; if (DataContract.GetBuiltInDataContract(objType)!= null) return obj; return surrogate.GetDeserializedObject(obj, memberType); } internal static object GetCustomDataToExport(IDataContractSurrogate surrogate, MemberInfo memberInfo, Type dataContractType) { return surrogate.GetCustomDataToExport(memberInfo, dataContractType); } internal static object GetCustomDataToExport(IDataContractSurrogate surrogate, Type clrType, Type dataContractType) { if (DataContract.GetBuiltInDataContract(clrType)!= null) return null; return surrogate.GetCustomDataToExport(clrType, dataContractType); } internal static void GetKnownCustomDataTypes(IDataContractSurrogate surrogate, Collection customDataTypes) { surrogate.GetKnownCustomDataTypes(customDataTypes); } internal static Type GetReferencedTypeOnImport(IDataContractSurrogate surrogate, string typeName, string typeNamespace, object customData) { if(DataContract.GetBuiltInDataContract(typeName, typeNamespace) != null) return null; return surrogate.GetReferencedTypeOnImport(typeName, typeNamespace, customData); } internal static CodeTypeDeclaration ProcessImportedType(IDataContractSurrogate surrogate, CodeTypeDeclaration typeDeclaration, CodeCompileUnit compileUnit) { return surrogate.ProcessImportedType(typeDeclaration, compileUnit); } } } // 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
- InstanceKey.cs
- TypeExtension.cs
- BufferedMessageWriter.cs
- AddInController.cs
- SafeRightsManagementQueryHandle.cs
- EntityDataSourceContainerNameConverter.cs
- FilteredAttributeCollection.cs
- IISUnsafeMethods.cs
- CategoryGridEntry.cs
- CqlQuery.cs
- ScrollProperties.cs
- OleCmdHelper.cs
- ImageSourceConverter.cs
- WebPartEditVerb.cs
- HwndAppCommandInputProvider.cs
- TraceInternal.cs
- ManagementNamedValueCollection.cs
- EncoderReplacementFallback.cs
- Utility.cs
- MetadataArtifactLoader.cs
- ScrollBar.cs
- DateTimeStorage.cs
- _CommandStream.cs
- XmlDocument.cs
- ImageSourceValueSerializer.cs
- DbQueryCommandTree.cs
- Message.cs
- SecurityTokenProviderContainer.cs
- PointAnimationClockResource.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- PagerStyle.cs
- ProxyWebPart.cs
- MailMessage.cs
- MarkerProperties.cs
- Validator.cs
- LinqDataSourceStatusEventArgs.cs
- TemplateKey.cs
- ClientTargetCollection.cs
- DiscoveryDocumentSearchPattern.cs
- ElementHost.cs
- FixedHighlight.cs
- KeyboardEventArgs.cs
- PeerEndPoint.cs
- BorderGapMaskConverter.cs
- DecoderNLS.cs
- ConfigurationConverterBase.cs
- SiteMapNodeItemEventArgs.cs
- StructuredTypeEmitter.cs
- ContextMenu.cs
- DataControlLinkButton.cs
- VectorCollectionConverter.cs
- MenuTracker.cs
- ProjectionCamera.cs
- PropertyPanel.cs
- AsymmetricKeyExchangeDeformatter.cs
- QilChoice.cs
- SchemaImporterExtensionElementCollection.cs
- DbParameterHelper.cs
- OdbcRowUpdatingEvent.cs
- ComponentCommands.cs
- VerificationException.cs
- Internal.cs
- SelectionHighlightInfo.cs
- ContextActivityUtils.cs
- DataGridViewLayoutData.cs
- Base64Encoder.cs
- CodeCastExpression.cs
- KeyBinding.cs
- FloaterBaseParagraph.cs
- ServiceCredentialsSecurityTokenManager.cs
- StdValidatorsAndConverters.cs
- CompositeScriptReference.cs
- AsyncPostBackErrorEventArgs.cs
- pingexception.cs
- DataGridViewButtonColumn.cs
- HTMLTagNameToTypeMapper.cs
- FrameworkElement.cs
- Rfc2898DeriveBytes.cs
- Rotation3D.cs
- DBSchemaTable.cs
- OleDragDropHandler.cs
- WorkflowRuntimeEndpoint.cs
- XmlDataCollection.cs
- QilXmlWriter.cs
- PackageStore.cs
- IteratorDescriptor.cs
- JoinGraph.cs
- ProtectedConfiguration.cs
- DelegatedStream.cs
- PopupRoot.cs
- TypeSystem.cs
- ScriptResourceAttribute.cs
- TextCompositionManager.cs
- AppDomainFactory.cs
- TextAnchor.cs
- Drawing.cs
- XmlSchemaIdentityConstraint.cs
- HyperLink.cs
- EmptyStringExpandableObjectConverter.cs
- CurrentChangedEventManager.cs