【发布时间】:2020-07-07 16:34:54
【问题描述】:
这在 PG 中是可能的:
public class Parent
{
[Column(TypeName = "jsonb")]
//Mode 1: a column in the table
public Child[] Children { get; set; }
}
public class Child
{
//Mode 2: a virtual column only existing in JSON
public GrandChild[] GrandChildren { get; set; }
}
public class GrandChild
{
}
我的问题是,是否有一种方法可以内联使用其他 CLR 类型,而不是数组,例如 List<T>、HashSet<T> 甚至只是 IList<T> 或 ICollection<T>,以实现轻松访问并避免重新创建每次我们想要进行更改或避免定义一堆其他代理属性时的集合。
我尝试将HasConversion 设置为数组,但没有成功。
【问题讨论】:
标签: c# json postgresql entity-framework-core npgsql