在Entity Framework Core中是否可以将复合主键映射为单个Value Object?然后:它在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中映射它?请注意,在(n)Hibernate中可以进行此类映射和LINQ查询。我希望EF Core也能实现同样的目标...