Closed drewdelano closed 3 years ago
This seemed to work for me: https://github.com/SpatialFocus/EFIdentityColumnWithValueConverterWorkaround
Is there also a version of that workaround for SQL Server?
The following does not work :-(
modelBuilder.Entity<Customer>(entity =>
{
entity.ToTable("Customer", "dbo");
entity.HasKey(e => e.Id);
entity.Property(e => e.Id)
.HasColumnName("Id")
.HasColumnType("bigint")
.HasConversion<CustomerId.EfCoreValueConverter>()
.ValueGeneratedOnAdd();
// ...
});
It looks like there's a bug in EF that prevents it from recognizing strongly typed IDs (longs / int64) as potential identity columns.
Has anyone found a way to avoid this? I'd put this in the EF Core repo, but I'm guessing it wouldn't be prioritized.