Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / Serializers / TextSerializer.cs / 1305376 / TextSerializer.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for text content. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { #region Namespaces. using System.Diagnostics; using System.IO; using System.Text; using System.Xml; #endregion Namespaces. ////// Provides support for serializing responses in text format. /// internal struct TextSerializer : IExceptionWriter { ///Writer to which output is sent. private readonly TextWriter writer; ///Initializes a new /// Stream to which output should be sent. /// Encoding to be used to write the result. internal TextSerializer(Stream output, Encoding encoding) { Debug.Assert(output != null, "output != null"); Debug.Assert(encoding != null, "encoding != null"); this.writer = new StreamWriter(output, encoding); } ///for the specified stream. Serializes exception information. /// Description of exception to serialize. public void WriteException(HandleExceptionArgs args) { XmlWriter xmlWriter = XmlWriter.Create(this.writer); ErrorHandler.SerializeXmlError(args, xmlWriter); this.writer.Flush(); } ///Handles the complete serialization for the specified content. /// Single Content to write.. ///internal void WriteRequest(object content) { Debug.Assert(content != null, "content != null"); string contentAsText; if (!System.Data.Services.Parsing.WebConvert.TryXmlPrimitiveToString(content, out contentAsText)) { throw new InvalidOperationException(Strings.Serializer_CannotConvertValue(content)); } Debug.Assert(contentAsText != null, "contentAsText != null"); this.writer.Write(contentAsText); this.writer.Flush(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. should be a byte array.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OletxDependentTransaction.cs
- AuthorizationRuleCollection.cs
- StringWriter.cs
- RequestQueue.cs
- DesignSurfaceManager.cs
- TouchPoint.cs
- CryptoKeySecurity.cs
- X509ChainElement.cs
- Int16Converter.cs
- ConstructorNeedsTagAttribute.cs
- SimpleTextLine.cs
- TableProviderWrapper.cs
- InteropAutomationProvider.cs
- BinaryObjectWriter.cs
- ExceptQueryOperator.cs
- ToolStripItemImageRenderEventArgs.cs
- isolationinterop.cs
- RegexCapture.cs
- ExtractorMetadata.cs
- httpserverutility.cs
- SqlExpressionNullability.cs
- regiisutil.cs
- HandledEventArgs.cs
- TargetInvocationException.cs
- ValidationEventArgs.cs
- InvalidPropValue.cs
- PackageRelationship.cs
- ActivationArguments.cs
- DataControlExtensions.cs
- TempFiles.cs
- StaticFileHandler.cs
- PasswordTextContainer.cs
- LinkLabel.cs
- MembershipAdapter.cs
- ChangeTracker.cs
- WsdlInspector.cs
- RijndaelManaged.cs
- CodeTryCatchFinallyStatement.cs
- CodeSubDirectory.cs
- Collection.cs
- _StreamFramer.cs
- WebReference.cs
- InheritanceContextChangedEventManager.cs
- NativeActivityFaultContext.cs
- ListCollectionView.cs
- DataSourceCache.cs
- IgnoreDeviceFilterElementCollection.cs
- ApplyImportsAction.cs
- StorageBasedPackageProperties.cs
- RightsManagementPermission.cs
- AutomationPropertyInfo.cs
- CommonGetThemePartSize.cs
- FixUp.cs
- XmlConverter.cs
- FileBasedResourceGroveler.cs
- XmlNotation.cs
- ApplicationBuildProvider.cs
- EntryWrittenEventArgs.cs
- SecureStringHasher.cs
- MultipleViewPatternIdentifiers.cs
- ContentWrapperAttribute.cs
- XamlValidatingReader.cs
- SafeNativeMethods.cs
- WebHttpSecurityModeHelper.cs
- SmtpNetworkElement.cs
- ObjectDataSourceStatusEventArgs.cs
- RoutedEventValueSerializer.cs
- ReadOnlyDictionary.cs
- IriParsingElement.cs
- Random.cs
- Listener.cs
- RequestCachePolicyConverter.cs
- ReadOnlyTernaryTree.cs
- TimelineCollection.cs
- OleDbMetaDataFactory.cs
- PieceNameHelper.cs
- HostingEnvironmentSection.cs
- Polyline.cs
- ArraySegment.cs
- PropertyKey.cs
- DateTimeUtil.cs
- Ray3DHitTestResult.cs
- SqlHelper.cs
- TraceContextRecord.cs
- EventLogPermissionAttribute.cs
- ResourceManagerWrapper.cs
- figurelengthconverter.cs
- SystemColors.cs
- StructuredProperty.cs
- CodeExpressionStatement.cs
- TypedElement.cs
- DbDeleteCommandTree.cs
- ColumnHeader.cs
- KeyPullup.cs
- CodeDomExtensionMethods.cs
- CheckBox.cs
- ConnectAlgorithms.cs
- WebPartDisplayModeCollection.cs
- ArrayExtension.cs
- DeleteHelper.cs