【发布时间】:2020-06-19 21:43:00
【问题描述】:
我们正在将数据层从 oracle 转移到实体框架。 我正在尝试在 LINQ 中编写这个 oracle 查询
SELECT *
FROM (SELECT ld203_entity_id, ld203_entity_nm
FROM f.ld203_ent_lst
WHERE ld203_ent_nm <> 'Other' and LD203_ENT_HIDE='Y'
ORDER BY ld203_ent_nm ASC)
UNION ALL
SELECT *
FROM (SELECT ld203_ent_id, ld203_ent_nm
FROM f.ld203_ent_list
WHERE ld203_ent_nm = 'Other' and LD203_ENT_HIDE='Y'
ORDER BY ld203_ent_nm ASC);
LINQ 查询正在尝试..
var ls =
(from a in context.ld203_entity_list
where (a.ld203_entity_nm != "Other" && a.ld203_entity_hide == "Y")
select a.ld203_entity_id, a.ld203_entity_nm)
.Union
(from b in context.ld203_entity_list
where b.ld203_entity_nm == "Other" && b.ld203_entity_hide == "Y"
select b.ld203_entity_id, b.ld203_entity_nm);
dt = LINQResultToDataTable(ls);
谁能帮忙用什么方法在 LINQ C# 中重写它?
【问题讨论】:
-
到目前为止,您在 LINQ 中尝试过什么?向我们展示您的实体模型和代码。
-
添加了正在尝试的 linq 代码
标签: oracle entity-framework linq