Skip to content
New issue

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

EnumToString Value Converter does not work on owned types #1310

Open
jonowilliams26 opened this issue Nov 10, 2023 · 0 comments
Open

EnumToString Value Converter does not work on owned types #1310

jonowilliams26 opened this issue Nov 10, 2023 · 0 comments

Comments

@jonowilliams26
Copy link

Package Version: 7.1.6
EF Core Version: 7.0.13
EF Core SQL Server Version: 7.0.13

public class A
{
    public int Id { get; set; }
    public B B { get; set; }
}

public record B
{
    public Status Status { get; init; }
}

public enum Status
{
    Good,
    Bad
}

public class ATableConfiguration : IEntityTypeConfiguration<A>
{
    public void Configure(EntityTypeBuilder<Tag> builder)
    {
        builder.OwnsOne(x => x.B, builder => {
            builder.Property(x => x.Status).HasConversion<string>();
       });
    }
}

When running a bulk insert, B.Status is saved as an int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant