Repository: dotnet/efcore
File: src/EFCore.Relational/Metadata/Internal/RelationalModel.cs (C#)

Code before:
            var complexType = complexProperty.ComplexType;

            var complexViewMappings =
                (List<ViewMapping>?)complexType.FindRuntimeAnnotationValue(RelationalAnnotationNames.ViewMappings);
            if (complexViewMappings == null)
            {
                complexViewMappings = [];
                complexType.AddRuntimeAnnotation(RelationalAnnotationNames.ViewMappings, complexViewMappings);
            }

            CreateViewMapping(
                relationalTypeMappingSource,
                complexType,
                complexType,
                mappedView,
                databaseModel,
                complexViewMappings,
                includesDerivedTypes: true,
                isSplitEntityTypePrincipal: isSplitEntityTypePrincipal == true ? false : isSplitEntityTypePrincipal);
        }

        if (((ITableMappingBase)viewMapping).ColumnMappings.Any()
            || viewMappings.Count == 0)
        {
            viewMappings.Add(viewMapping);
            if(entityType is IEntityType)
            {
                view.EntityTypeMappings.Add(viewMapping);
            }
            else
            {
                view.ComplexTypeMappings.Add(viewMapping);
            }
        }
    }

    private static void AddSqlQueries(RelationalModel databaseModel, IEntityType entityType)
    {
        var entityTypeSqlQuery = entityType.GetSqlQuery();
        if (entityTypeSqlQuery == null)
        {
            return;
        }

        List<SqlQueryMapping>? queryMappings = null;
        var definingType = entityType;
        while (definingType != null)
        {
            var definingTypeSqlQuery = definingType.GetSqlQuery();
            if (definingTypeSqlQuery == null
                || definingType.BaseType == null

Review comment (suggestion):
Missing space after `if` keyword. Should be `if (entityType is IEntityType)` instead of `if(entityType is IEntityType)`.
```suggestion
            if (entityType is IEntityType)
```

Code after:

            var complexViewMappings =
                (List<ViewMapping>?)complexType.FindRuntimeAnnotationValue(RelationalAnnotationNames.ViewMappings);
            if (complexViewMappings == null)
            {
                complexViewMappings = [];
                complexType.AddRuntimeAnnotation(RelationalAnnotationNames.ViewMappings, complexViewMappings);
            }

            CreateViewMapping(
                relationalTypeMappingSource,
                complexType,
                complexType,
                mappedView,
                databaseModel,
                complexViewMappings,
                includesDerivedTypes: true,
                isSplitEntityTypePrincipal: isSplitEntityTypePrincipal == true ? false : isSplitEntityTypePrincipal);
        }

        if (((ITableMappingBase)viewMapping).ColumnMappings.Any()
            || viewMappings.Count == 0)
        {
            viewMappings.Add(viewMapping);
            if (entityType is IEntityType)
            {
                view.EntityTypeMappings.Add(viewMapping);
            }
            else
            {
                view.ComplexTypeMappings.Add(viewMapping);
            }
        }
    }

    private static void AddSqlQueries(RelationalModel databaseModel, IEntityType entityType)
    {
        var entityTypeSqlQuery = entityType.GetSqlQuery();
        if (entityTypeSqlQuery == null)
        {
            return;
        }

        List<SqlQueryMapping>? queryMappings = null;
        var definingType = entityType;
        while (definingType != null)
        {
            var definingTypeSqlQuery = definingType.GetSqlQuery();
            if (definingTypeSqlQuery == null
                || definingType.BaseType == null
                || (definingTypeSqlQuery == entityTypeSqlQuery