是否可以将列表与EF Core Postgres JSON一起使用?

问题描述 投票:0回答:1

在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
1个回答
0
投票

如果启用type plugins in Npgsql.Json.NET,则将“自动”运行:

type plugins
© www.soinside.com 2019 - 2024. All rights reserved.