Is it possible to map composite primary key as single Value Object in Entity Framework Core? And then: does it work properly in LINQ queries?

I know that prior to EF Core 2.2 support of VO was not very good.

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 }
}

Is it possible to map it in EF? Please, note that such mapping and LINQ querying is possible in (n)Hibernate. I would expect the same with EF Core...

0 Answers