EFCore.BulkExtensions
EFCore.BulkExtensions copied to clipboard
Upsert ignores custom conversions
Does EFCore.BulkExntensions
ignore custom conversions?
I receive the exception while try to use BulkInsertOrUpdateAsync
with PostgreSQL:
System.InvalidCastException: Can't write CLR type NodaTime.TimeZones.CachedDateTimeZone with handler type TextHandler
Conversion:
builder.Property(p => p.StartedAtZone).IsRequired()
.HasConversion(zone => zone.Id, id => DateTimeZoneProviders.Tzdb.GetZoneOrNull(id)).HasMaxLength(100);
The model contains next properties from NodaTime
library:
public class AnEntity
{
...
public LocalDateTime StartedAt { get; set; }
public DateTimeZone StartedAtZone { get; set; }
...
}
EFCore.BulkExtensions 6.2.0 Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime 6.0.1
Didn't have experience with NodaTime.