© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
5 replies
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 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; }
}
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
RequiredQualifications
?
for example:
public class RequiredQualifications
{
    public Guid WorkingTaskId {get;set;}
    public string? QualificationId { get; set; }
    public byte? Degree { get; set; }
}
public class RequiredQualifications
{
    public Guid WorkingTaskId {get;set;}
    public string? QualificationId { get; set; }
    public byte? Degree { get; set; }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Generic entity type in EF Core
C#CC# / help
4y ago
Entity Framework Core - how to setup this navigation correctly?
C#CC# / help
3y ago
EF-Core unable to create migration
C#CC# / help
2y ago