Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# .net core entity framework one to many

protected override void OnModelCreating(Modelbuilder modelBuilder)
{
    modelBuilder.Entity<Company>()
        .HasMany(c => c.Employees)
        .WithOne(e => e.Company);
}
Source by www.learnentityframeworkcore.com #
 
PREVIOUS NEXT
Tagged: #core #entity #framework
ADD COMMENT
Topic
Name
4+9 =