Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / Epm / EpmSyndicationContentDeSerializer.cs / 1305376 / EpmSyndicationContentDeSerializer.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Deserializer for the EPM content on the server // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Common { #region Namespaces using System.Data.Services.Providers; using System.ServiceModel.Syndication; using System.Diagnostics; using System.Xml; #endregion ///Syndication content reader for EPM content internal sealed class EpmSyndicationContentDeSerializer : EpmContentDeSerializerBase { ///Constructor ///to read content from /// State of the deserializer internal EpmSyndicationContentDeSerializer(SyndicationItem item, EpmContentDeSerializer.EpmContentDeserializerState state) : base(item, state) { } /// Publicly accessible deserialization entry point /// Type of resource to deserialize /// Token corresponding to object ofinternal void DeSerialize(ResourceType resourceType, object element) { this.DeSerialize(resourceType.EpmTargetTree.SyndicationRoot, resourceType, element); } /// Used for deserializing each of syndication specific content nodes /// Node in the target path being processed /// ResourceType /// object being deserialized private void DeSerialize(EpmTargetPathSegment currentRoot, ResourceType resourceType, object element) { foreach (EpmTargetPathSegment newRoot in currentRoot.SubSegments) { if (newRoot.HasContent) { if (!EpmContentDeSerializerBase.Match(newRoot, this.PropertiesApplied)) { switch (newRoot.EpmInfo.Attribute.TargetSyndicationItem) { case SyndicationItemProperty.AuthorEmail: if (this.Item.Authors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Authors[0].Email, this); } break; case SyndicationItemProperty.AuthorName: if (this.Item.Authors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Authors[0].Name, this); } break; case SyndicationItemProperty.AuthorUri: if (this.Item.Authors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Authors[0].Uri, this); } break; case SyndicationItemProperty.ContributorEmail: if (this.Item.Contributors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Contributors[0].Email, this); } break; case SyndicationItemProperty.ContributorName: if (this.Item.Contributors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Contributors[0].Name, this); } break; case SyndicationItemProperty.ContributorUri: if (this.Item.Contributors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Contributors[0].Uri, this); } break; case SyndicationItemProperty.Updated: // If this.Item.LastUpdatedTime == DateTimeOffset.MinValue we assume that the date has not been provided // by the user. This is the same assumption Syndication Api does (see Atom10FeedFormatter.WriteItemContents()). // If the date was not provided by the user we should not touch it - otherwise the response will not be // compatible with response sent for the same request and the same resource type but having KeepInContent set to true if (this.Item.LastUpdatedTime > DateTimeOffset.MinValue) { resourceType.SetEpmValue(newRoot, element, XmlConvert.ToString(this.Item.LastUpdatedTime), this); } break; case SyndicationItemProperty.Published: if (this.Item.PublishDate > DateTimeOffset.MinValue) { resourceType.SetEpmValue(newRoot, element, XmlConvert.ToString(this.Item.PublishDate), this); } break; case SyndicationItemProperty.Rights: if (this.Item.Copyright != null) { resourceType.SetEpmValue(newRoot, element, this.Item.Copyright.Text, this); } break; case SyndicationItemProperty.Summary: if (this.Item.Summary != null) { resourceType.SetEpmValue(newRoot, element, this.Item.Summary.Text, this); } break; case SyndicationItemProperty.Title: if (this.Item.Title != null) { resourceType.SetEpmValue(newRoot, element, this.Item.Title.Text, this); } break; default: Debug.Fail("Unhandled SyndicationItemProperty enum value - should never get here."); break; } } } else { this.DeSerialize(newRoot, resourceType, element); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Deserializer for the EPM content on the server // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Common { #region Namespaces using System.Data.Services.Providers; using System.ServiceModel.Syndication; using System.Diagnostics; using System.Xml; #endregion ///Syndication content reader for EPM content internal sealed class EpmSyndicationContentDeSerializer : EpmContentDeSerializerBase { ///Constructor ///to read content from /// State of the deserializer internal EpmSyndicationContentDeSerializer(SyndicationItem item, EpmContentDeSerializer.EpmContentDeserializerState state) : base(item, state) { } /// Publicly accessible deserialization entry point /// Type of resource to deserialize /// Token corresponding to object ofinternal void DeSerialize(ResourceType resourceType, object element) { this.DeSerialize(resourceType.EpmTargetTree.SyndicationRoot, resourceType, element); } /// Used for deserializing each of syndication specific content nodes /// Node in the target path being processed /// ResourceType /// object being deserialized private void DeSerialize(EpmTargetPathSegment currentRoot, ResourceType resourceType, object element) { foreach (EpmTargetPathSegment newRoot in currentRoot.SubSegments) { if (newRoot.HasContent) { if (!EpmContentDeSerializerBase.Match(newRoot, this.PropertiesApplied)) { switch (newRoot.EpmInfo.Attribute.TargetSyndicationItem) { case SyndicationItemProperty.AuthorEmail: if (this.Item.Authors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Authors[0].Email, this); } break; case SyndicationItemProperty.AuthorName: if (this.Item.Authors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Authors[0].Name, this); } break; case SyndicationItemProperty.AuthorUri: if (this.Item.Authors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Authors[0].Uri, this); } break; case SyndicationItemProperty.ContributorEmail: if (this.Item.Contributors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Contributors[0].Email, this); } break; case SyndicationItemProperty.ContributorName: if (this.Item.Contributors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Contributors[0].Name, this); } break; case SyndicationItemProperty.ContributorUri: if (this.Item.Contributors.Count > 0) { resourceType.SetEpmValue(newRoot, element, this.Item.Contributors[0].Uri, this); } break; case SyndicationItemProperty.Updated: // If this.Item.LastUpdatedTime == DateTimeOffset.MinValue we assume that the date has not been provided // by the user. This is the same assumption Syndication Api does (see Atom10FeedFormatter.WriteItemContents()). // If the date was not provided by the user we should not touch it - otherwise the response will not be // compatible with response sent for the same request and the same resource type but having KeepInContent set to true if (this.Item.LastUpdatedTime > DateTimeOffset.MinValue) { resourceType.SetEpmValue(newRoot, element, XmlConvert.ToString(this.Item.LastUpdatedTime), this); } break; case SyndicationItemProperty.Published: if (this.Item.PublishDate > DateTimeOffset.MinValue) { resourceType.SetEpmValue(newRoot, element, XmlConvert.ToString(this.Item.PublishDate), this); } break; case SyndicationItemProperty.Rights: if (this.Item.Copyright != null) { resourceType.SetEpmValue(newRoot, element, this.Item.Copyright.Text, this); } break; case SyndicationItemProperty.Summary: if (this.Item.Summary != null) { resourceType.SetEpmValue(newRoot, element, this.Item.Summary.Text, this); } break; case SyndicationItemProperty.Title: if (this.Item.Title != null) { resourceType.SetEpmValue(newRoot, element, this.Item.Title.Text, this); } break; default: Debug.Fail("Unhandled SyndicationItemProperty enum value - should never get here."); break; } } } else { this.DeSerialize(newRoot, resourceType, element); } } } } } // 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
- QilValidationVisitor.cs
- MetaChildrenColumn.cs
- DataListItemEventArgs.cs
- ExtendedPropertiesHandler.cs
- LayoutInformation.cs
- TextInfo.cs
- EntitySqlQueryCacheEntry.cs
- WriteableOnDemandStream.cs
- ShapingEngine.cs
- GifBitmapEncoder.cs
- DbModificationClause.cs
- RemoteWebConfigurationHostStream.cs
- DocumentPageView.cs
- MSAAWinEventWrap.cs
- ImageEditor.cs
- SHA512CryptoServiceProvider.cs
- SqlBuilder.cs
- MasterPageBuildProvider.cs
- ADConnectionHelper.cs
- DataViewSetting.cs
- DiagnosticsConfigurationHandler.cs
- FileRecordSequence.cs
- AspProxy.cs
- XmlDocumentFragment.cs
- HttpRequestBase.cs
- RijndaelManagedTransform.cs
- RootBrowserWindow.cs
- DataGridViewTextBoxCell.cs
- complextypematerializer.cs
- PinnedBufferMemoryStream.cs
- UnlockInstanceAsyncResult.cs
- ListViewDataItem.cs
- Popup.cs
- GeometryModel3D.cs
- SchemaImporterExtensionsSection.cs
- SystemParameters.cs
- QilXmlWriter.cs
- IteratorFilter.cs
- ImageAutomationPeer.cs
- FixedSOMLineRanges.cs
- ImageMap.cs
- UndirectedGraph.cs
- SystemColorTracker.cs
- ColorMatrix.cs
- SafeRightsManagementSessionHandle.cs
- XmlSchemaFacet.cs
- IOThreadScheduler.cs
- PerfCounters.cs
- WebPartDisplayMode.cs
- XamlToRtfParser.cs
- GridItemCollection.cs
- XmlSchemaInferenceException.cs
- ClickablePoint.cs
- CodeTypeReferenceCollection.cs
- StorageInfo.cs
- Privilege.cs
- BasicViewGenerator.cs
- PeerOutputChannel.cs
- WebPartDisplayMode.cs
- ControlEvent.cs
- SpStreamWrapper.cs
- TraceHandlerErrorFormatter.cs
- TagPrefixAttribute.cs
- FormViewInsertedEventArgs.cs
- Process.cs
- RadioButton.cs
- TextRenderer.cs
- ScalarOps.cs
- MaskedTextProvider.cs
- ThreadAbortException.cs
- RectangleConverter.cs
- DiscoveryDocumentSearchPattern.cs
- MemoryResponseElement.cs
- VectorAnimationUsingKeyFrames.cs
- OracleSqlParser.cs
- QueryIntervalOp.cs
- ReadOnlyDictionary.cs
- RequestCacheEntry.cs
- SortDescriptionCollection.cs
- ScriptingRoleServiceSection.cs
- ServiceContractViewControl.Designer.cs
- TreeIterators.cs
- SQLChars.cs
- AddressHeaderCollectionElement.cs
- SwitchAttribute.cs
- RoutedEvent.cs
- AnnotationStore.cs
- SqlFacetAttribute.cs
- ListViewInsertedEventArgs.cs
- Translator.cs
- RegexRunner.cs
- COM2ExtendedTypeConverter.cs
- AutomationPatternInfo.cs
- CustomCategoryAttribute.cs
- PreservationFileReader.cs
- SamlDelegatingWriter.cs
- QueryOptionExpression.cs
- Vector3dCollection.cs
- DrawItemEvent.cs
- ScrollBar.cs