Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Web / System / Web / Services / Description / MimeXmlReflector.cs / 1305376 / MimeXmlReflector.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Services.Description { using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Serialization; using System.Xml.Schema; using System.Collections; using System; using System.Reflection; using System.Xml; internal class MimeXmlReflector : MimeReflector { internal override bool ReflectParameters() { return false; } internal override bool ReflectReturn() { MessagePart part = new MessagePart(); part.Name = "Body"; ReflectionContext.OutputMessage.Parts.Add(part); if (typeof(XmlNode).IsAssignableFrom(ReflectionContext.Method.ReturnType)) { MimeContentBinding mimeContentBinding = new MimeContentBinding(); mimeContentBinding.Type = "text/xml"; mimeContentBinding.Part = part.Name; ReflectionContext.OperationBinding.Output.Extensions.Add(mimeContentBinding); } else { MimeXmlBinding mimeXmlBinding = new MimeXmlBinding(); mimeXmlBinding.Part = part.Name; LogicalMethodInfo methodInfo = ReflectionContext.Method; XmlAttributes a = new XmlAttributes(methodInfo.ReturnTypeCustomAttributeProvider); XmlTypeMapping xmlTypeMapping = ReflectionContext.ReflectionImporter.ImportTypeMapping(methodInfo.ReturnType, a.XmlRoot); xmlTypeMapping.SetKey(methodInfo.GetKey() + ":Return"); ReflectionContext.SchemaExporter.ExportTypeMapping(xmlTypeMapping); part.Element = new XmlQualifiedName(xmlTypeMapping.XsdElementName, xmlTypeMapping.Namespace); ReflectionContext.OperationBinding.Output.Extensions.Add(mimeXmlBinding); } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Services.Description { using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Serialization; using System.Xml.Schema; using System.Collections; using System; using System.Reflection; using System.Xml; internal class MimeXmlReflector : MimeReflector { internal override bool ReflectParameters() { return false; } internal override bool ReflectReturn() { MessagePart part = new MessagePart(); part.Name = "Body"; ReflectionContext.OutputMessage.Parts.Add(part); if (typeof(XmlNode).IsAssignableFrom(ReflectionContext.Method.ReturnType)) { MimeContentBinding mimeContentBinding = new MimeContentBinding(); mimeContentBinding.Type = "text/xml"; mimeContentBinding.Part = part.Name; ReflectionContext.OperationBinding.Output.Extensions.Add(mimeContentBinding); } else { MimeXmlBinding mimeXmlBinding = new MimeXmlBinding(); mimeXmlBinding.Part = part.Name; LogicalMethodInfo methodInfo = ReflectionContext.Method; XmlAttributes a = new XmlAttributes(methodInfo.ReturnTypeCustomAttributeProvider); XmlTypeMapping xmlTypeMapping = ReflectionContext.ReflectionImporter.ImportTypeMapping(methodInfo.ReturnType, a.XmlRoot); xmlTypeMapping.SetKey(methodInfo.GetKey() + ":Return"); ReflectionContext.SchemaExporter.ExportTypeMapping(xmlTypeMapping); part.Element = new XmlQualifiedName(xmlTypeMapping.XsdElementName, xmlTypeMapping.Namespace); ReflectionContext.OperationBinding.Output.Extensions.Add(mimeXmlBinding); } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebControlToolBoxItem.cs
- BaseResourcesBuildProvider.cs
- ButtonField.cs
- InputScope.cs
- ListParagraph.cs
- _TransmitFileOverlappedAsyncResult.cs
- BrowsableAttribute.cs
- TextElementAutomationPeer.cs
- ResourceSet.cs
- DurationConverter.cs
- SqlBooleanMismatchVisitor.cs
- QuaternionAnimationUsingKeyFrames.cs
- ControlBuilder.cs
- XsdDataContractExporter.cs
- VectorValueSerializer.cs
- HtmlInputImage.cs
- FormViewInsertEventArgs.cs
- Command.cs
- Matrix3D.cs
- SerializableAuthorizationContext.cs
- Matrix.cs
- Restrictions.cs
- MemberInfoSerializationHolder.cs
- XmlSiteMapProvider.cs
- GeneralTransformGroup.cs
- CollectionBuilder.cs
- Duration.cs
- SqlDeflator.cs
- DataGridViewHitTestInfo.cs
- AnnotationComponentChooser.cs
- ImageField.cs
- NameValueFileSectionHandler.cs
- StructuredProperty.cs
- SqlTransaction.cs
- COM2FontConverter.cs
- CryptoKeySecurity.cs
- OdbcTransaction.cs
- TextEditorSelection.cs
- ResourcesBuildProvider.cs
- Boolean.cs
- AnimationClockResource.cs
- RewritingPass.cs
- Double.cs
- ClipboardData.cs
- PhonemeEventArgs.cs
- RootBrowserWindowAutomationPeer.cs
- DateTimeSerializationSection.cs
- userdatakeys.cs
- TabControlCancelEvent.cs
- Vector3dCollection.cs
- MarginsConverter.cs
- ClassData.cs
- SqlParameter.cs
- ListSortDescription.cs
- ToolboxDataAttribute.cs
- EnlistmentState.cs
- RuntimeConfigurationRecord.cs
- ChangePassword.cs
- RealProxy.cs
- Processor.cs
- Win32.cs
- EventLogInternal.cs
- RunInstallerAttribute.cs
- XPathLexer.cs
- BrushConverter.cs
- WebPartZoneBase.cs
- StickyNoteAnnotations.cs
- ActivatedMessageQueue.cs
- SectionXmlInfo.cs
- HtmlTitle.cs
- InputLanguageSource.cs
- DataGrid.cs
- DmlSqlGenerator.cs
- Mappings.cs
- StringFunctions.cs
- ImageAutomationPeer.cs
- ApplyImportsAction.cs
- ServiceProviders.cs
- TriggerActionCollection.cs
- WebEventCodes.cs
- KeyboardDevice.cs
- VisualStyleElement.cs
- TextFormatterHost.cs
- TableItemPatternIdentifiers.cs
- PerformanceCounterPermissionEntry.cs
- DecimalConverter.cs
- IntranetCredentialPolicy.cs
- KernelTypeValidation.cs
- WebPartMenuStyle.cs
- SaveFileDialog.cs
- AnimatedTypeHelpers.cs
- UpdateExpressionVisitor.cs
- XmlSerializerSection.cs
- ValueExpressions.cs
- XpsFixedPageReaderWriter.cs
- CombinedGeometry.cs
- FileController.cs
- RotateTransform.cs
- CodeGenerator.cs
- HtmlLiteralTextAdapter.cs