src/Shared/EntityFramework/Core/Mapping/ViewValidator.cs
// <summary>
// Determines whether the given view is valid.
// </summary>
// <param name="view"> Query view to validate. </param>
// <param name="setMapping"> Mapping in which view is declared. </param>
// <returns> Errors in view definition. </returns>
Determines whether the given view is valid.
Determines whether the given view is valid .
internal static IEnumerable<EdmSchemaError> ValidateQueryView(
            DbQueryCommandTree view, EntitySetBaseMapping setMapping, EntityTypeBase elementType, bool includeSubtypes)
        {
            var validator = new ViewExpressionValidator(setMapping, elementType, includeSubtypes);
            validator.VisitExpression(view.Query);
            if (validator.Errors.Count() == 0)
            {
                if (setMapping.Set.BuiltInTypeKind
                    == BuiltInTypeKind.AssociationSet)
                {
                    var refValidator = new AssociationSetViewValidator(setMapping);
                    refValidator.VisitExpression(view.Query);
                    return refValidator.Errors;
                }
            }
            return validator.Errors;
        }
internal static IEnumerable < EdmSchemaError > ValidateQueryView ( DbQueryCommandTree view , EntitySetBaseMapping setMapping , EntityTypeBase elementType , bool includeSubtypes ) { var validator = new ViewExpressionValidator ( setMapping , elementType , includeSubtypes ) ; validator . VisitExpression ( view . Query ) ; if ( validator . Errors . Count ( ) == 0 ) { if ( setMapping . Set . BuiltInTypeKind == BuiltInTypeKind . AssociationSet ) { var refValidator = new AssociationSetViewValidator ( setMapping ) ; refValidator . VisitExpression ( view . Query ) ; return refValidator . Errors ; } } return validator . Errors ; }
Determines whether the given view is valid.
Determines whether the given view is valid .
//For AssociationSet views, we have to check for a specific pattern of errors where //the Ref expression passed into the constructor might use an EntitySet that is different from //the EntitySet defined in the CSDL.
Errors in view definition.
Errors in view definition .
view
DbQueryCommandTree
Query view to validate.
Query view to validate .
setMapping
EntitySetBaseMapping
Mapping in which view is declared.
Mapping in which view is declared .
elementType
EntityTypeBase
includeSubtypes
bool