Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# .net core entity framework one to many

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