C#C
C#2y ago
SWEETPONY

How to create entity correctly? [EF CORE]

I have a following model:
public sealed record WorkingTask: BaseEntity
{
    public required string Identity {get;set;}
    public IReadOnlyList<RequiredQualifications>? RequiredQualifications { get; init; }
}

public class RequiredQualifications
{
    public string? QualificationId { get; set; }
    public byte? Degree { get; set; }
}


how to store it correctly in database?
should it be 1 - 1 or many-many? how to configure it in ef core?

maybe I should add Id property to
RequiredQualifications
?
for example:
public class RequiredQualifications
{
    public Guid WorkingTaskId {get;set;}
    public string? QualificationId { get; set; }
    public byte? Degree { get; set; }
}
Was this page helpful?