artiomchi / FlexLabs.Upsert

FlexLabs.Upsert is a library that brings UPSERT functionality to common database providers for Entity Framework in their respective native SQL syntax
MIT License
515 stars 81 forks source link

Does not insert OwnsOne columns #156

Open adminnz opened 5 months ago

adminnz commented 5 months ago

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.

kristian-dam-bori commented 4 months ago

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

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