With (PostgreSQL) native JSON support, it's useful to map Dictionary directly to JSON columns. This works e.g. for Dictionary<string,string>, but fails for Dictionary<string,object> since the property is detected as a property bag:
public class Blog
{
public int Id { get; set; }
[Column(TypeName = "jsonb")]
public Dictionary<string, object> JsonProperty { get; set; }
}
The exception:
The navigation 'Blog.JsonProperty' must be configured in 'OnModelCreating' with an explicit name for the target shared-type entity type, or excluded by calling 'EntityTypeBuilder.Ignore'.
We may want to stop detecting property bags if column has an explicit store type. Following on how type converters work, this can be worked around by configuring the property with .Metadata.SetProviderClrType(null).
/cc @AndriySvyryd
Originally filed by @ColinZeb in npgsql/efcore.pg#2134
With (PostgreSQL) native JSON support, it's useful to map Dictionary directly to JSON columns. This works e.g. for
Dictionary<string,string>, but fails forDictionary<string,object>since the property is detected as a property bag:The exception:
We may want to stop detecting property bags if column has an explicit store type. Following on how type converters work, this can be worked around by configuring the property with
.Metadata.SetProviderClrType(null)./cc @AndriySvyryd
Originally filed by @ColinZeb in npgsql/efcore.pg#2134