Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Server / System / Data / Services / Serializers / Atom10FormatterFactory.cs / 2 / Atom10FormatterFactory.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Provides a formatter factory for ATOM 1.0.
//
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Serializers
{
using System.Diagnostics;
using System.IO;
using System.ServiceModel.Syndication;
using System.Text;
using System.Xml;
/// Provides support for serializing responses in ATOM 1.0 format.
///
/// For more information, see http://tools.ietf.org/html/rfc4287.
///
internal sealed class Atom10FormatterFactory : SyndicationFormatterFactory
{
/// Creates a new instance of the class.
/// A new instance of the class.
internal override SyndicationFeedFormatter CreateSyndicationFeedFormatter()
{
return new Atom10FeedFormatter();
}
///
/// Creates a new instance of the class with the specified
/// instance.
///
/// The to serialize.
///
/// A new instance of the class with the specified
/// instance.
///
internal override SyndicationFeedFormatter CreateSyndicationFeedFormatter(SyndicationFeed feedToWrite)
{
Debug.Assert(feedToWrite != null, "feedToWrite != null");
return new Atom10FeedFormatter(feedToWrite);
}
/// Creates a new instance of the class.
/// A new instance of the class.
internal override SyndicationItemFormatter CreateSyndicationItemFormatter()
{
return new Atom10ItemFormatter();
}
///
/// Creates a new instance of the class with the specified
/// instance.
///
/// The to serialize.
/// A new instance of the class.
internal override SyndicationItemFormatter CreateSyndicationItemFormatter(SyndicationItem itemToWrite)
{
Debug.Assert(itemToWrite != null, "itemToWrite != null");
string value;
if (itemToWrite.AttributeExtensions.TryGetValue(SyndicationSerializer.QualifiedNullAttribute, out value) &&
value == XmlConstants.XmlTrueLiteral)
{
return null;
}
return new Atom10ItemFormatter(itemToWrite);
}
///
/// Creates an over the specified with the given
/// , to be used with an appropriate formatter.
///
/// Stream over which to read (the reader should close it when it's done with it).
/// Encoding of the stream, possibly null.
/// A new instance.
internal override XmlReader CreateReader(Stream stream, Encoding encoding)
{
Debug.Assert(stream != null, "stream != null");
return XmlUtil.CreateXmlReader(stream, encoding);
}
///
/// Creates an into the specified with the given
/// , to be used with an appropriate formatter.
///
/// Stream over which to write (the writer should close it when it's done with it).
/// Encoding of the stream.
/// A new instance.
internal override XmlWriter CreateWriter(Stream stream, Encoding encoding)
{
Debug.Assert(stream != null, "stream != null");
Debug.Assert(encoding != null, "encoding != null");
return XmlUtil.CreateXmlWriterAndWriteProcessingInstruction(stream, encoding);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Provides a formatter factory for ATOM 1.0.
//
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Serializers
{
using System.Diagnostics;
using System.IO;
using System.ServiceModel.Syndication;
using System.Text;
using System.Xml;
/// Provides support for serializing responses in ATOM 1.0 format.
///
/// For more information, see http://tools.ietf.org/html/rfc4287.
///
internal sealed class Atom10FormatterFactory : SyndicationFormatterFactory
{
/// Creates a new instance of the class.
/// A new instance of the class.
internal override SyndicationFeedFormatter CreateSyndicationFeedFormatter()
{
return new Atom10FeedFormatter();
}
///
/// Creates a new instance of the class with the specified
/// instance.
///
/// The to serialize.
///
/// A new instance of the class with the specified
/// instance.
///
internal override SyndicationFeedFormatter CreateSyndicationFeedFormatter(SyndicationFeed feedToWrite)
{
Debug.Assert(feedToWrite != null, "feedToWrite != null");
return new Atom10FeedFormatter(feedToWrite);
}
/// Creates a new instance of the class.
/// A new instance of the class.
internal override SyndicationItemFormatter CreateSyndicationItemFormatter()
{
return new Atom10ItemFormatter();
}
///
/// Creates a new instance of the class with the specified
/// instance.
///
/// The to serialize.
/// A new instance of the class.
internal override SyndicationItemFormatter CreateSyndicationItemFormatter(SyndicationItem itemToWrite)
{
Debug.Assert(itemToWrite != null, "itemToWrite != null");
string value;
if (itemToWrite.AttributeExtensions.TryGetValue(SyndicationSerializer.QualifiedNullAttribute, out value) &&
value == XmlConstants.XmlTrueLiteral)
{
return null;
}
return new Atom10ItemFormatter(itemToWrite);
}
///
/// Creates an over the specified with the given
/// , to be used with an appropriate formatter.
///
/// Stream over which to read (the reader should close it when it's done with it).
/// Encoding of the stream, possibly null.
/// A new instance.
internal override XmlReader CreateReader(Stream stream, Encoding encoding)
{
Debug.Assert(stream != null, "stream != null");
return XmlUtil.CreateXmlReader(stream, encoding);
}
///
/// Creates an into the specified with the given
/// , to be used with an appropriate formatter.
///
/// Stream over which to write (the writer should close it when it's done with it).
/// Encoding of the stream.
/// A new instance.
internal override XmlWriter CreateWriter(Stream stream, Encoding encoding)
{
Debug.Assert(stream != null, "stream != null");
Debug.Assert(encoding != null, "encoding != null");
return XmlUtil.CreateXmlWriterAndWriteProcessingInstruction(stream, encoding);
}
}
}
// 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
- File.cs
- UnaryNode.cs
- XPathSelectionIterator.cs
- StylusButton.cs
- X500Name.cs
- MobileControlDesigner.cs
- HttpPostedFile.cs
- XPathEmptyIterator.cs
- FileClassifier.cs
- CodeObject.cs
- OleTxTransaction.cs
- IncrementalCompileAnalyzer.cs
- ContentPlaceHolderDesigner.cs
- WebPartMovingEventArgs.cs
- ViewStateException.cs
- EntityCommand.cs
- TextDecorationCollection.cs
- CodeCompiler.cs
- ObjectResult.cs
- AddInServer.cs
- SplineKeyFrames.cs
- ArrangedElement.cs
- ProgressPage.cs
- WebExceptionStatus.cs
- TextElementEditingBehaviorAttribute.cs
- WindowsImpersonationContext.cs
- MailWriter.cs
- CodeCommentStatement.cs
- RotationValidation.cs
- arclist.cs
- HttpSessionStateBase.cs
- HtmlTableRowCollection.cs
- ProcessHostConfigUtils.cs
- DataGridViewRowCancelEventArgs.cs
- TextModifierScope.cs
- Descriptor.cs
- DataGrid.cs
- ToolStripDesignerAvailabilityAttribute.cs
- BuildResultCache.cs
- UTF7Encoding.cs
- path.cs
- MergePropertyDescriptor.cs
- CurrentTimeZone.cs
- SettingsProperty.cs
- ScopelessEnumAttribute.cs
- ArrayConverter.cs
- SmtpAuthenticationManager.cs
- EntitySqlQueryCacheKey.cs
- IndexingContentUnit.cs
- AssociatedControlConverter.cs
- WindowsGraphics.cs
- PropertyValueChangedEvent.cs
- PropertyEmitter.cs
- CompilerGlobalScopeAttribute.cs
- UnhandledExceptionEventArgs.cs
- SrgsGrammarCompiler.cs
- MatrixIndependentAnimationStorage.cs
- AuthenticationModeHelper.cs
- XmlSchemaGroup.cs
- CustomWebEventKey.cs
- SqlDataSourceView.cs
- ClientBuildManagerCallback.cs
- WsatServiceAddress.cs
- ErrorHandlingAcceptor.cs
- FontFamily.cs
- DateTimePickerDesigner.cs
- PermissionSetEnumerator.cs
- VisualTarget.cs
- ObjectMaterializedEventArgs.cs
- TextModifierScope.cs
- ToolboxSnapDragDropEventArgs.cs
- SystemDropShadowChrome.cs
- ObjectDataSource.cs
- IndependentAnimationStorage.cs
- SqlHelper.cs
- XmlCharacterData.cs
- MediaScriptCommandRoutedEventArgs.cs
- AsymmetricSignatureDeformatter.cs
- PrintDocument.cs
- compensatingcollection.cs
- MDIControlStrip.cs
- MessagePropertyDescription.cs
- MiniConstructorInfo.cs
- Convert.cs
- AnnotationMap.cs
- PrintDialog.cs
- ActivityTypeCodeDomSerializer.cs
- SQLBytes.cs
- NumberFormatter.cs
- TextEditorDragDrop.cs
- PageFunction.cs
- WeakHashtable.cs
- PropertyMapper.cs
- HtmlControlDesigner.cs
- XmlSchemaSimpleContent.cs
- ProgressBar.cs
- FixedStringLookup.cs
- NumericExpr.cs
- ItemsPanelTemplate.cs
- SchemaMapping.cs