B.r.a.iS
B.r.a.iS
CC#
Created by B.r.a.iS on 10/10/2024 in #help
EF Core - Intermediate table or Navigation Properties?
Hi everyone, A beginner question here. I’m working on a .NET project using Entity Framework Core and SQL Server. I have two entities, Organizations and Modules, where an organization can have multiple modules, and a module can belong to multiple organizations. I initially thought of creating an intermediate table OrganizationModules to handle this many-to-many relationship. My question is: With Entity Framework Core, do I still need to explicitly define this intermediate table, or can I just rely on navigation properties (ICollection<Module> in Organization and ICollection<Organization> in Module) and let EF Core handle the join table behind the scenes? Also, when would you recommend defining the intermediate table as an entity explicitly? Thank you!
6 replies