Repository: dotnet/efcore
File: src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs (C#)

Code before:

    /// <summary>
    ///     Throws an <see cref="InvalidOperationException" /> with a message containing provider-specific information, when
    ///     available, indicating possible reasons why the property cannot be mapped.
    /// </summary>
    /// <param name="propertyType">The property CLR type.</param>
    /// <param name="typeBase">The structural type.</param>
    /// <param name="unmappedProperty">The property.</param>
    protected override void ThrowPropertyNotMappedException(
        string propertyType,
        ITypeBase typeBase,
        IProperty unmappedProperty)
    {
        var clrType = unmappedProperty.ClrType;
        var declaringClrType = typeBase.ClrType;

        if (IsSpatialType(clrType) || IsSpatialType(declaringClrType))
        {
            throw new InvalidOperationException(
                RelationalStrings.PropertyNotMappedSpatial(
                    propertyType,
                    typeBase.DisplayName(),
                    unmappedProperty.Name));
        }

        if (IsHierarchyIdType(clrType) || IsHierarchyIdType(declaringClrType))
        {
            throw new InvalidOperationException(
                RelationalStrings.PropertyNotMappedHierarchyId(
                    propertyType,
                    typeBase.DisplayName(),
                    unmappedProperty.Name));
        }

        var storeType = unmappedProperty.GetColumnType();
        if (storeType != null)
        {
            throw new InvalidOperationException(
                RelationalStrings.PropertyNotMapped(
                    propertyType,
                    typeBase.DisplayName(),
                    unmappedProperty.Name,
                    storeType));
        }

        base.ThrowPropertyNotMappedException(propertyType, typeBase, unmappedProperty);

        static bool IsSpatialType(Type type)
            => type.FullName?.StartsWith("NetTopologySuite.Geometries.", StringComparison.Ordinal) == true;

        static bool IsHierarchyIdType(Type type)

Review comment (refactor):
HierarchyId is specific to SQL Server, move this to SqlServerModelValidator (as well as all the rest of the stuff).

Code after:

    /// <summary>
    ///     Throws an <see cref="InvalidOperationException" /> with a message containing provider-specific information, when
    ///     available, indicating possible reasons why the property cannot be mapped.
    /// </summary>
    /// <param name="propertyType">The property CLR type.</param>
    /// <param name="typeBase">The structural type.</param>
    /// <param name="unmappedProperty">The property.</param>
    protected override void ThrowPropertyNotMappedException(
        string propertyType,
        ITypeBase typeBase,
        IProperty unmappedProperty)
    {
        if (unmappedProperty.ClrType.FullName?.StartsWith("NetTopologySuite.Geometries.", StringComparison.Ordinal) == true
            || typeBase.ClrType.FullName?.StartsWith("NetTopologySuite.Geometries.", StringComparison.Ordinal) == true)
        {
            throw new InvalidOperationException(
                RelationalStrings.PropertyNotMappedSpatial(
                    propertyType,
                    typeBase.DisplayName(),
                    unmappedProperty.Name));
        }

        var storeType = unmappedProperty.GetColumnType();
        if (storeType != null)
        {
            throw new InvalidOperationException(
                RelationalStrings.PropertyNotMapped(
                    propertyType,
                    typeBase.DisplayName(),
                    unmappedProperty.Name,
                    storeType));
        }

        base.ThrowPropertyNotMappedException(propertyType, typeBase, unmappedProperty);
    }
}