Npgsql 代码首先无法使用 Postgres13 映射 JSON 数据类型

时间:2021-02-09 07:03:16

标签: c# postgresql entity-framework-6 npgsql

我有以下简单的代码优先模型

    [Key]
    public string LicenceNumber { get; set; }
    public int? Year { get; set; }
    [Column(TypeName = "json")] // problem here.
    public string ModelList { get; set; }

然后我尝试在 VS2019 PM 控制台中创建迁移文件

PM> add-migration db1

并在 PM 控制台中收到错误消息,根本没有创建迁移文件。

The store type 'json' could not be found in the Npgsql provider manifest

我进行了搜索,但即使开发人员说some datatype may not get well support from EF6.

也没有多大帮助

这里是环境。

  • 实体框架 6.4
  • Npgsql 4.1.3
  • Postgres 13
  • Windows 10,VS2019

任何帮助/建议将不胜感激。

1 个答案:

答案 0 :(得分:0)

Npgsql EF6 提供程序不支持 JSON - 这确实与 EF6 的类型支持存在问题有关。

EF Core 提供程序确实更好地支持 JSON,see the docs

相关问题