API

HasOne / WithMany

Configures a reference-to-collection relationship.

Formal Syntax & Structure

csharp syntaxcsharp
model.Entity<Book>().HasOne(b => b.Category).WithMany(c => c.Books)

Working Example

Example Snippetcsharp
// Documentary fragment; see mapped lesson for context.model.Entity<Book>().HasOne(b => b.Category).WithMany(c => c.Books)
C# & .NET Reference