【发布时间】:2019-05-17 18:46:20
【问题描述】:
我有 4 张桌子:
部门
Id
-----------
1
2
3
员工
Id
----
a
b
c
d
e
Dep2Employee
DepId EmployeeId
----------- ----------
1 a
1 b
2 c
2 d
3 e
员工历史
EmplId ReportType Timestamp
----------- ---------- ----------
1 type1 12.12.12
1 type3 13.12.12
2 type2 14.12.12
3 type2 15.12.12
是否有可能在一个 LINQ (EF Core) 表达式中为在 Department 工作的所有员工获取所有具有给定 ID 的 type1 报告,按顺序排列按时间戳?类似GetAllReportsOfType1(string departmentId)
SQL 查询的样子也很有趣。
谢谢。
【问题讨论】:
-
有没有可能 -- 当然有,使用导航属性甚至会变得非常简单。
标签: c# sql linq entity-framework-core