We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have this scenario:
public class TimeRecord ... public required TimeRecordSource Source { get; set; } } public class TimeRecordSource { public required TimeRecordSourceType Type { get; set; } public string? Name { get; set; } public string? Id { get; set; } } public enum TimeRecordSourceType { Unknown = 0, Device, Operator, }
With this configuration:
public class TimeRecordConfiguration : IEntityTypeConfiguration<TimeRecord> { public void Configure(EntityTypeBuilder<TimeRecord> builder) { ... builder.OwnsOne(typeof(TimeRecordSource), nameof(TimeRecord.Source)); } }
When I'm trying a BulkInsertAsync, I receive this error: Can't write CLR type Namespace.TimeRecordSourceType with handler type Int32Handler
Can't write CLR type Namespace.TimeRecordSourceType with handler type Int32Handler
Originally, I had this configuration:
builder.OwnsOne(typeof(TimeRecordSource), nameof(TimeRecord.Source)).Property(nameof(TimeRecordSource.Type)).HasConversion<string>().HasMaxLength(50);
But failed too with this error: Can't write CLR type Namespace.TimeRecordSourceType with handler type String
Can't write CLR type Namespace.TimeRecordSourceType with handler type String
How can I do this scenario to work?
The text was updated successfully, but these errors were encountered:
On PG for this case Converter needs to be explicitly configured in OnModelCreating:
modelBuilder.Entity<TimeRecord>().OwnsOne(a => a.Source, b => b.Property(p => p.Type).HasConversion(new EnumToNumberConverter<TimeRecordSourceType, int>()));
Sorry, something went wrong.
No branches or pull requests
I have this scenario:
With this configuration:
When I'm trying a BulkInsertAsync, I receive this error:
Can't write CLR type Namespace.TimeRecordSourceType with handler type Int32Handler
Originally, I had this configuration:
But failed too with this error:
Can't write CLR type Namespace.TimeRecordSourceType with handler type String
How can I do this scenario to work?
The text was updated successfully, but these errors were encountered: