Repository: dotnet/efcore
File: src/EFCore.Relational/Extensions/RelationalTypeBaseExtensions.cs (C#)

Code before:
    /// <param name="typeBase">The type to get the container column type configuration source for.</param>
    /// <returns>The <see cref="ConfigurationSource" /> for the container column type.</returns>
    public static ConfigurationSource? GetContainerColumnTypeConfigurationSource(this IConventionTypeBase typeBase)
        => typeBase.FindAnnotation(RelationalAnnotationNames.ContainerColumnType)
            ?.GetConfigurationSource();

    /// <summary>
    ///     Gets the value of JSON property name used for the given entity mapped to a JSON column.
    /// </summary>
    /// <remarks>
    ///     Unless configured explicitly, navigation name is used.
    /// </remarks>
    /// <param name="typeBase">The type.</param>
    /// <returns>
    ///     The value for the JSON property used to store this type.
    ///     <see langword="null" /> is returned for entities that are not mapped to a JSON column.
    /// </returns>
    public static string? GetJsonPropertyName(this IReadOnlyTypeBase typeBase)
        => (string?)typeBase.FindAnnotation(RelationalAnnotationNames.JsonPropertyName)?.Value
            ?? (!typeBase.IsMappedToJson()
                ? null
                : typeBase is IReadOnlyEntityType entityType
                    ? entityType.FindOwnership()!.GetNavigation(pointsToPrincipal: false)!.Name
                    : typeBase.FindAnnotation(RelationalAnnotationNames.ContainerColumnName) != null
                        ? null
                        : ((IReadOnlyComplexType)typeBase).ComplexProperty.Name);

    #endregion
}


Review comment (suggestion):
@copilot This should return null if typeBase.FindAnnotation(RelationalAnnotationNames.JsonPropertyName).Value is null or if typeBase.FindAnnotation(RelationalAnnotationNames.ContainerColumnName) is not null (move the new condition up)

Code after:
    /// <param name="typeBase">The type to get the container column type configuration source for.</param>
    /// <returns>The <see cref="ConfigurationSource" /> for the container column type.</returns>
    public static ConfigurationSource? GetContainerColumnTypeConfigurationSource(this IConventionTypeBase typeBase)
        => typeBase.FindAnnotation(RelationalAnnotationNames.ContainerColumnType)
            ?.GetConfigurationSource();

    /// <summary>
    ///     Gets the value of JSON property name used for the given entity mapped to a JSON column.
    /// </summary>
    /// <remarks>
    ///     Unless configured explicitly, navigation name is used.
    /// </remarks>
    /// <param name="typeBase">The type.</param>
    /// <returns>
    ///     The value for the JSON property used to store this type.
    ///     <see langword="null" /> is returned for entities that are not mapped to a JSON column.
    /// </returns>
    public static string? GetJsonPropertyName(this IReadOnlyTypeBase typeBase)
    {
        var annotation = typeBase.FindAnnotation(RelationalAnnotationNames.JsonPropertyName);
        if (annotation != null)
        {
            return (string?)annotation.Value;
        }

        return typeBase.FindAnnotation(RelationalAnnotationNames.ContainerColumnName) != null || !typeBase.IsMappedToJson()
            ? null
            : typeBase is IReadOnlyEntityType entityType
                ? entityType.FindOwnership()!.GetNavigation(pointsToPrincipal: false)!.Name
                : ((IReadOnlyComplexType)typeBase).ComplexProperty.Name;
    }

    /// <summary>
    ///     Sets the value of JSON property name used for the given type mapped to a JSON column.
    /// </summary>
    /// <param name="typeBase">The type.</param>
    /// <param name="name">The name to be used.</param>
    public static void SetJsonPropertyName(this IMutableTypeBase typeBase, string? name)
        => typeBase.SetOrRemoveAnnotation(
            RelationalAnnotationNames.JsonPropertyName,
            Check.NullButNotEmpty(name));

    /// <summary>
    ///     Sets the value of JSON property name used for the given type mapped to a JSON column.
    /// </summary>
    /// <param name="typeBase">The type.</param>
    /// <param name="name">The name to be used.</param>
    /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
    /// <returns>The configured value.</returns>
    public static string? SetJsonPropertyName(
        this IConventionTypeBase typeBase,