Entity Framework 核心 postgresql 数组类型映射不工作

Entity Framework Core postgresql Array Type Mapping not working

我有一个奇怪的问题,也许这是我遗漏的问题,但我有以下 LINQ Lambda 查询:

var ss = ctx.ShipZones.SelectMany(
                z => ctx.ShipDecks,
                (z, d) =>
                    new
                    {
                        Zone = z.ZIndex,
                        Deck = d.DIndex,
                        Value = ctx.Tags
                            .AsExpandable()
                            .Include(s => s.TagSettings.Device.System)
                            .Where(s =>
                                 s.TagSettings.TagTypeId == 171
                                 && s.TagSettings.Device.System.Id == z.Id
                                 && s.TagSettings.Device.ControlArea.Contains(d.Id)

                                    )
                            .Average(s => s.Value)

                    }
                ).ToList();

根据this文章,这应该翻译成这样:

SELECT z.z_index AS "Zone", d.d_index AS "Deck", (
  SELECT AVG(t.value)
  FROM tags_current_data AS t
  INNER JOIN tags_settings AS t0 ON t.tag_id = t0.id
  INNER JOIN systems_devices AS s ON t0.device_id = s.id
  INNER JOIN systems AS s0 ON s.system_id = s0.id
  WHERE ((t0.tag_type_id = 171) AND (s0.id = z.id)) AND (d.id = ANY(s.control_area))) AS "Value"
FROM zones AS z
CROSS JOIN decks AS d

但不知何故,翻译后的查询是这样的:

SELECT z.z_index AS "Zone", d.d_index AS "Deck", (
  SELECT AVG(t.value)
  FROM tags_current_data AS t
  INNER JOIN tags_settings AS t0 ON t.tag_id = t0.id
  INNER JOIN systems_devices AS s ON t0.device_id = s.id
  INNER JOIN systems AS s0 ON s.system_id = s0.id
  WHERE ((t0.tag_type_id = 171) AND (s0.id = z.id)) AND (TRUE = FALSE)) AS "Value"
FROM zones AS z
CROSS JOIN decks AS d

不同的地方应该是d.id = ANY(s.control_area)TRUE = FALSE

谁能告诉我我做错了什么?

提前致谢,

朱利安季米特洛夫

我能够解决我的问题。它在 this 期。

基本上:

It was in the entities configuration. The ControlArea property in the Device entity was of type List<long>. When I changed it to long[] (long array) it worked!