Skip to content

EnumToString not working in BatchUpdateAsync #397

Closed
@IeuanWalker

Description

Hi,

I have this table -

[Table("Settings")]
public class SettingsTbl
{
    [Key]
    public SettingsEnum Setting { get; set; }
    [Required]
    [MaxLength(20)]
    public string Value { get; set; }
}

and this in the database context -

modelBuilder
    .Entity<SettingsTbl>()
    .Property(e => e.Setting)
    .HasConversion<string>();

Calling this method -

public async Task UpdateSetting(SettingsEnum setting, object value)
{
    await dbSet
        .Where(x => x.Setting == setting)
        .BatchUpdateAsync(x => new SettingsTbl
        {
            Value = value.ToString()
        })
        .ConfigureAwait(false);
}

Throws the following error -
image

Using NuGet version - 3.2.3

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions