Ejemplo n.º 1
0
        private void EndEntry()
        {
            IODataAtomReaderEntryState currentEntryState = this.CurrentEntryState;
            ODataEntry entry = currentEntryState.Entry;

            if (entry != null)
            {
                if (currentEntryState.CachedEpm != null)
                {
                    AtomScope currentScope = (AtomScope)base.CurrentScope;
                    if (currentScope.HasAtomEntryMetadata)
                    {
                        EpmSyndicationReader.ReadEntryEpm(currentEntryState, this.atomInputContext);
                    }
                    if (currentScope.HasEpmCustomReaderValueCache)
                    {
                        EpmCustomReader.ReadEntryEpm(currentEntryState, this.atomInputContext);
                    }
                }
                if (currentEntryState.AtomEntryMetadata != null)
                {
                    entry.SetAnnotation <AtomEntryMetadata>(currentEntryState.AtomEntryMetadata);
                }
                IEdmEntityType entityType = currentEntryState.EntityType;
                if ((!currentEntryState.MediaLinkEntry.HasValue && (entityType != null)) && this.atomInputContext.Model.HasDefaultStream(entityType))
                {
                    ODataAtomEntryAndFeedDeserializer.EnsureMediaResource(currentEntryState, true);
                }
                bool validateMediaResource = this.atomInputContext.UseDefaultFormatBehavior || this.atomInputContext.UseServerFormatBehavior;
                ValidationUtils.ValidateEntryMetadata(entry, entityType, this.atomInputContext.Model, validateMediaResource);
            }
            this.ReplaceScope(ODataReaderState.EntryEnd);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads the syndication EPM for an entry.
        /// </summary>
        /// <param name="entryState">The reader entry state for the entry to which the EPM is applied.</param>
        /// <param name="inputContext">The input context currently in use.</param>
        internal static void ReadEntryEpm(
            IODataAtomReaderEntryState entryState,
            ODataAtomInputContext inputContext)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(entryState != null, "entryState != null");
            Debug.Assert(entryState.CachedEpm != null, "To read entry EPM, the entity type must have an EPM annotation.");
            Debug.Assert(inputContext != null, "inputContext != null");

            EpmSyndicationReader epmSyndicationReader = new EpmSyndicationReader(entryState, inputContext);

            epmSyndicationReader.ReadEntryEpm();
        }