/// <summary> /// Validates the type of an entry in a top-level feed. /// </summary> /// <param name="entityType">The type of the entry.</param> internal void ValidateEntry(IEdmEntityType entityType) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(entityType != null, "entityType != null"); // If we don't have a type, store the type of the first item. if (this.itemType == null) { this.itemType = entityType; } // Validate the expected and actual types. if (this.itemType.IsEquivalentTo(entityType)) { return; } // If the types are not equivalent, make sure they have a common base type. IEdmType commonBaseType = EdmLibraryExtensions.GetCommonBaseType(this.itemType, entityType); if (commonBaseType == null) { throw new ODataException(Strings.FeedWithoutExpectedTypeValidator_IncompatibleTypes(entityType.ODataFullName(), this.itemType.ODataFullName())); } this.itemType = (IEdmEntityType)commonBaseType; }