Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / Serializers / XmlDocumentSerializer.cs / 1305376 / XmlDocumentSerializer.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for the Atom Service Document format. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { using System; using System.Data.Services.Providers; using System.Diagnostics; using System.IO; using System.Text; using System.Xml; ///Provides support for serializing generic XML documents. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Pending review.")] [DebuggerDisplay("XmlDocumentSerializer={baseUri}")] internal abstract class XmlDocumentSerializer : IExceptionWriter { ///Base URI from which resources should be resolved. private readonly Uri baseUri; ///Data provider from which metadata should be gathered. private readonly DataServiceProviderWrapper provider; ///Writer to which output is sent. private readonly XmlWriter writer; ////// Initializes a new XmlDocumentSerializer, ready to write /// out an XML document /// /// Stream to which output should be sent. /// Base URI from which resources should be resolved. /// Data provider from which metadata should be gathered. /// Text encoding for the response. internal XmlDocumentSerializer( Stream output, Uri baseUri, DataServiceProviderWrapper provider, Encoding encoding) { Debug.Assert(output != null, "output != null"); Debug.Assert(provider != null, "provider != null"); Debug.Assert(baseUri != null, "baseUri != null"); Debug.Assert(encoding != null, "encoding != null"); Debug.Assert(baseUri.IsAbsoluteUri, "baseUri.IsAbsoluteUri(" + baseUri + ")"); Debug.Assert(baseUri.AbsoluteUri[baseUri.AbsoluteUri.Length - 1] == '/', "baseUri(" + baseUri.AbsoluteUri + ") ends with '/'"); this.writer = XmlUtil.CreateXmlWriterAndWriteProcessingInstruction(output, encoding); this.provider = provider; this.baseUri = baseUri; } ///Base URI from which resources should be resolved. protected Uri BaseUri { get { return this.baseUri; } } ///Data provider from which metadata should be gathered. protected DataServiceProviderWrapper Provider { get { return this.provider; } } ///Writer to which output is sent. protected XmlWriter Writer { get { return this.writer; } } ///Serializes exception information. /// Description of exception to serialize. public void WriteException(HandleExceptionArgs args) { ErrorHandler.SerializeXmlError(args, this.writer); } ///Writes the document for this request.. /// Data service instance. internal abstract void WriteRequest(IDataService service); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for the Atom Service Document format. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { using System; using System.Data.Services.Providers; using System.Diagnostics; using System.IO; using System.Text; using System.Xml; ///Provides support for serializing generic XML documents. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Pending review.")] [DebuggerDisplay("XmlDocumentSerializer={baseUri}")] internal abstract class XmlDocumentSerializer : IExceptionWriter { ///Base URI from which resources should be resolved. private readonly Uri baseUri; ///Data provider from which metadata should be gathered. private readonly DataServiceProviderWrapper provider; ///Writer to which output is sent. private readonly XmlWriter writer; ////// Initializes a new XmlDocumentSerializer, ready to write /// out an XML document /// /// Stream to which output should be sent. /// Base URI from which resources should be resolved. /// Data provider from which metadata should be gathered. /// Text encoding for the response. internal XmlDocumentSerializer( Stream output, Uri baseUri, DataServiceProviderWrapper provider, Encoding encoding) { Debug.Assert(output != null, "output != null"); Debug.Assert(provider != null, "provider != null"); Debug.Assert(baseUri != null, "baseUri != null"); Debug.Assert(encoding != null, "encoding != null"); Debug.Assert(baseUri.IsAbsoluteUri, "baseUri.IsAbsoluteUri(" + baseUri + ")"); Debug.Assert(baseUri.AbsoluteUri[baseUri.AbsoluteUri.Length - 1] == '/', "baseUri(" + baseUri.AbsoluteUri + ") ends with '/'"); this.writer = XmlUtil.CreateXmlWriterAndWriteProcessingInstruction(output, encoding); this.provider = provider; this.baseUri = baseUri; } ///Base URI from which resources should be resolved. protected Uri BaseUri { get { return this.baseUri; } } ///Data provider from which metadata should be gathered. protected DataServiceProviderWrapper Provider { get { return this.provider; } } ///Writer to which output is sent. protected XmlWriter Writer { get { return this.writer; } } ///Serializes exception information. /// Description of exception to serialize. public void WriteException(HandleExceptionArgs args) { ErrorHandler.SerializeXmlError(args, this.writer); } ///Writes the document for this request.. /// Data service instance. internal abstract void WriteRequest(IDataService service); } } // 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
- EqualityArray.cs
- SchemaImporterExtensionsSection.cs
- PkcsUtils.cs
- NativeMethods.cs
- CustomAttributeBuilder.cs
- TrustLevel.cs
- XmlSchemaValidator.cs
- EmissiveMaterial.cs
- ArrayMergeHelper.cs
- DataView.cs
- CrossContextChannel.cs
- ActivityExecutor.cs
- AsymmetricKeyExchangeDeformatter.cs
- ObjectDataSourceSelectingEventArgs.cs
- Attachment.cs
- Descriptor.cs
- HttpCookie.cs
- FormatConvertedBitmap.cs
- HeaderedItemsControl.cs
- RegexGroup.cs
- MappingMetadataHelper.cs
- Nodes.cs
- HttpCapabilitiesEvaluator.cs
- FontSourceCollection.cs
- ContentHostHelper.cs
- DesignerAttribute.cs
- OverlappedContext.cs
- OperandQuery.cs
- GeneralTransform3D.cs
- ApplicationGesture.cs
- EntityParameter.cs
- NativeObjectSecurity.cs
- ServicesUtilities.cs
- SqlDataSourceView.cs
- Ray3DHitTestResult.cs
- EntityContainerEntitySetDefiningQuery.cs
- RulePatternOps.cs
- StateMachineAction.cs
- DesignerOptionService.cs
- OleDbPermission.cs
- FloaterBaseParagraph.cs
- StringUtil.cs
- SelectedCellsChangedEventArgs.cs
- Stack.cs
- Canvas.cs
- RegexReplacement.cs
- StrokeSerializer.cs
- XmlILIndex.cs
- regiisutil.cs
- DatePicker.cs
- Material.cs
- InternalsVisibleToAttribute.cs
- UICuesEvent.cs
- ResourceContainer.cs
- Function.cs
- WebServicesDescriptionAttribute.cs
- IUnknownConstantAttribute.cs
- InertiaRotationBehavior.cs
- Form.cs
- TaiwanLunisolarCalendar.cs
- DisplayInformation.cs
- DiagnosticsConfiguration.cs
- Soap12ServerProtocol.cs
- ExceptionHelpers.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- TextServicesPropertyRanges.cs
- XmlWriterTraceListener.cs
- TextChange.cs
- DbConnectionPoolGroupProviderInfo.cs
- OdbcException.cs
- ContextStaticAttribute.cs
- LinkDescriptor.cs
- DecoderNLS.cs
- ListViewCancelEventArgs.cs
- SqlCacheDependencyDatabaseCollection.cs
- ObjectNotFoundException.cs
- RichTextBoxConstants.cs
- DispatcherEventArgs.cs
- UserControlBuildProvider.cs
- XamlPathDataSerializer.cs
- WebBrowserContainer.cs
- DbDataReader.cs
- GroupItemAutomationPeer.cs
- ControlIdConverter.cs
- HttpException.cs
- SubpageParagraph.cs
- _LoggingObject.cs
- webbrowsersite.cs
- RoleService.cs
- SpotLight.cs
- BitVec.cs
- TimeManager.cs
- RubberbandSelector.cs
- SmiRecordBuffer.cs
- MSG.cs
- Button.cs
- CodeDirectiveCollection.cs
- ObjectQueryExecutionPlan.cs
- QilUnary.cs
- QuotedPrintableStream.cs