Npgsql 8.0 + EFCore 8.0 + JSON Colums with type List<T> not working
Hello!
I'm not sure if this is a bug or intended behavior, but I'm trying to have a
a json column. According to the docs, in version 8
Then, as per the docs, I'm setting up my
This all compiles and runs, but when I enter data into this column the value of the column is
I already tried
As @viceroypenguin |
suggested, however this just gives a
when initializing the database. Is this scenario still supported without a wrapper class, which in my opinion is quite an ugly workaround since this is quite the nice use case for a JSON column?
I'm not sure if this is a bug or intended behavior, but I'm trying to have a
Patient entity that can have a dynamic amount of phone numbers by making its propertypublic List<PhoneNumber> PhoneNumbers { get; set; } = new();a json column. According to the docs, in version 8
[ColumnType("jsonb")] has been deprecated in favor of using .ToJson(), which I'm now trying to apply since I just upgraded from net7 and Npgsql 7 to 8. I'm setting up EnableDynamicJson() in my DbContext as follows:Then, as per the docs, I'm setting up my
PatientConfiguration as follows:This all compiles and runs, but when I enter data into this column the value of the column is
{"Capacity": 4}I already tried
As @viceroypenguin |
Entity 'PhoneNumber' is mapped to JSON and also to a table or view 'phone_number', but its owner 'Patient' is mapped to a different table or view 'patients'. Every entity mapped to JSON must also map to the same table or view as its owner.
when initializing the database. Is this scenario still supported without a wrapper class, which in my opinion is quite an ugly workaround since this is quite the nice use case for a JSON column?