entity-framework - 将复合主键映射为单个值对象(就 DDD 而言)?
问题描述
是否可以在 Entity Framework Core 中将复合主键映射为单个值对象?然后:它在 LINQ 查询中是否正常工作?
我知道在 EF Core 2.2 之前对 VO 的支持不是很好。
public class AssignmentIdentity
{
// ...
public EmployeeIdentity EmployeeId { get; protected set }
public TaskIdentity TaskId { get; protected set; }
}
public class Assignment
{
// ...
public AssignmentIdentity Id { get; protected set }
}
public class EmployeeIdentity
{
// ...
public String Identifier { get; protected set }
}
public class Employee
{
// ...
public EmployeeIdentity Id { get; protected set }
}
public class TaskIdentity
{
// ...
public String Identifier { get; protected set }
}
public class Task
{
// ...
public TaskIdentity Id { get; protected set }
}
是否可以在 EF 中映射它?请注意,这种映射和 LINQ 查询在 (n)Hibernate 中是可能的。我希望 EF Core 也一样...
解决方案
推荐阅读
- python-3.x - 转换成mfccs时如何遍历音频文件
- php - 如何在php中比较和查找两个json变量的json格式的不匹配数据
- dynamic - 如何使用卡尔曼滤波器找到 VAR 模型的时变系数
- grafana - Grafana 和 Prometheus:自动添加指标
- android - 无法使用 FusedLocationProvider 将 Gps 设置升级到高精度在某些设备中
- sql - 有外键时更新表
- openlayers-3 - 如何在鼠标移动之前使创建的绘图可见
- r - 如何使用 ggplot_build 和 ggplot_gtable 调整 facet_grid 框架和箱线图之间的距离
- java - 如何在应用程序前台制作一个信号推送通知警报
- python - pd.Series.reset_index() 索引从 n1 到 n2