/// <summary>
    ///     Returns the database schema that contains the mapped view.
    /// </summary>
    /// <param name="entityType">The entity type to get the view schema for.</param>
    /// <returns>The database schema that contains the mapped view.</returns>
    public static string?GetViewSchema(this IReadOnlyEntityType entityType)
    {
        var schemaAnnotation = entityType.FindAnnotation(RelationalAnnotationNames.ViewSchema);

        if (schemaAnnotation != null)
        {
            return((string?)schemaAnnotation.Value ?? GetDefaultViewSchema(entityType));
        }

        return(entityType.BaseType != null
            ? entityType.GetRootType().GetViewSchema()
            : GetDefaultViewSchema(entityType));
    }
    /// <summary>
    ///     Returns the name of the table to which the entity type is mapped
    ///     or <see langword="null" /> if not mapped to a table.
    /// </summary>
    /// <param name="entityType">The entity type to get the table name for.</param>
    /// <returns>The name of the table to which the entity type is mapped.</returns>
    public static string?GetTableName(this IReadOnlyEntityType entityType)
    {
        var nameAnnotation = entityType.FindAnnotation(RelationalAnnotationNames.TableName);

        if (nameAnnotation != null)
        {
            return((string?)nameAnnotation.Value);
        }

        if (entityType.BaseType != null)
        {
            return(entityType.GetRootType().GetTableName());
        }

        return((entityType as IConventionEntityType)?.GetViewNameConfigurationSource() == null &&
               ((entityType as IConventionEntityType)?.GetFunctionNameConfigurationSource() == null)
#pragma warning disable CS0618 // Type or member is obsolete
               && ((entityType as IConventionEntityType)?.GetDefiningQueryConfigurationSource() == null)
#pragma warning restore CS0618 // Type or member is obsolete
               && ((entityType as IConventionEntityType)?.GetSqlQueryConfigurationSource() == null)
                ? GetDefaultTableName(entityType)
                : null);
    }