src/Shared/EntityFramework/Core/SchemaObjectModel/ValidationHelper.cs
// <summary>
// Validated whether a type is declared correctly.
// </summary>
// <param name="element"> Schema element being validated. Must not be null. </param>
// <param name="type"> Resolved type (from declaration on the element). Possibly null. </param>
// <param name="typeSubElement"> Child schema element. Possibly null. </param>
// <remarks>
// For some elements (e.g. ReturnType) we allow the type to be defined inline in an attribute on the element itself or
// by using nested elements. These definitions are mutually exclusive.
// </remarks>
Validated whether a type is declared correctly.
Validated whether a type is declared correctly .
internal static void ValidateTypeDeclaration(SchemaElement element, SchemaType type, SchemaElement typeSubElement)
        {
            DebugCheck.NotNull(element);
            if (type == null
                && typeSubElement == null)
            {
                element.AddError(ErrorCode.TypeNotDeclared, EdmSchemaErrorSeverity.Error, Strings.TypeMustBeDeclared);
            }
            if (type != null
                && typeSubElement != null)
            {
                element.AddError(
                    ErrorCode.TypeDeclaredAsAttributeAndElement, EdmSchemaErrorSeverity.Error, Strings.TypeDeclaredAsAttributeAndElement);
            }
        }
internal static void ValidateTypeDeclaration ( SchemaElement element , SchemaType type , SchemaElement typeSubElement ) { DebugCheck . NotNull ( element ) ; if ( type == null && typeSubElement == null ) { element . AddError ( ErrorCode . TypeNotDeclared , EdmSchemaErrorSeverity . Error , Strings . TypeMustBeDeclared ) ; } if ( type != null && typeSubElement != null ) { element . AddError ( ErrorCode . TypeDeclaredAsAttributeAndElement , EdmSchemaErrorSeverity . Error , Strings . TypeDeclaredAsAttributeAndElement ) ; } }
Validated whether a type is declared correctly.
Validated whether a type is declared correctly .
//Type not declared as either attribute or subelement //Both attribute and sub-element declarations exist
element
SchemaElement
Schema element being validated. Must not be null.
Schema element being validated . Must not be null .
type
SchemaType
Resolved type (from declaration on the element). Possibly null.
Resolved type ( from declaration on the element ) . Possibly null .
typeSubElement
SchemaElement
Child schema element. Possibly null.
Child schema element . Possibly null .
remarks
For some elements  we allow the type to be defined inline in an attribute on the element itself or
by using nested elements. These definitions are mutually exclusive.
For some elements we allow the type to be defined inline in an attribute on the element itself or by using nested elements . These definitions are mutually exclusive .