Int? returns -2147482647 instead of null

Put On Hold on Stack Overflow so copying it here.

I have a data class

[Table("Members")]
public partial class MemberEmail
{
    [Key]
    public int Id { get; set; }
    public string Email { get; set; }
    public int? StackId { get; set; }
}

The data table does have an unique non clustered filtered index on StackId

Using Management Studio, using

select * from members

I can see that StackId is NULL. If I generate the script to create the table, the column structure is given by

[StackId] [int] NULL

However when I retrieve the record using

var member = connect.MemberEmails.SingleOrDefault(x => x.Email == request.Email);

Where connect is the DbContext,

instead of member.StackId == null I see that it is -2147482647

I am using Microsoft.AspNetCore.App 2.2.1

In OnModelCreating I have

modelBuilder.Entity<MemberEmail>().HasIndex(x => x.Email).IsUnique(true);
modelBuilder.Entity<MemberEmail>().HasIndex(x => x.StackHeadId).IsUnique(true);

The docs show that just using

  public int StackId { get; set; }

and omitting the [Required] attribute will create a nullable column

Thus the answer is not to use int?