FlexLabs.Upsert icon indicating copy to clipboard operation
FlexLabs.Upsert copied to clipboard

Does not insert OwnsOne columns

Open adminnz opened this issue 1 year ago • 2 comments

My postgresql database has:

CREATE TABLE events
(
    ...
    error_details JSONB NULL
    ...
)

In my model i have:

modelBuilder.Entity<Event>().OwnsOne(x => x.ErrorDetails, builder => builder.ToJson("error_details"));

Which when using the ef core Add(..) or Update(..) methods correctly serializes the nested object to json and stored.

But using Upsert(...) the resulting sql does not produce the error_details column.

When i look at the ef core EntityType model, the error_details is not listed in the GetProperties(), so I don't know where it is meant to be fetched from.

adminnz avatar Dec 12 '23 01:12 adminnz

I've also experienced this after using the new .ToJson() EF API.

Worked flawlessly before when using the .HasColumnType("jsonb")

kristian-dam-bori avatar Jan 09 '24 14:01 kristian-dam-bori