Skip to content

By default, EF Core will create a One-To-One relationship if reference navigation property has set on principal as well as dependent entity. The principal entity can have zero-or-one association with the dependent entity. Dependent entity can have only one association with Principal entity.

Notifications You must be signed in to change notification settings

geeksarray/EF-Core-Fluent-API-Relationship

Repository files navigation

EF Core Fluent API Relationship

This explains how you can configure One-To-One, One-to-Many, Many-To-Many entity relationships using Fluent API in Entity Framework Core. Configuring these relationships between entities are important for the implementation of code first approach.

Fluent API provides HasRequired, WithOptional, HasRequired, HasMany, WithRequiredPrincipal, WithMany method to configure different relationships between entities.

  1. Entity folder has different entity, relationship between these entities are configured using Fluent API.
  2. Migrations/initial has migration related scripts.

Entity Relations with Fluent API

For more information on configuring ER relations using Fluent API [click here] (https://geeksarray.com/blog/how-to-configure-entity-relationships-using-fluent-api-in-entity-framework)

About

By default, EF Core will create a One-To-One relationship if reference navigation property has set on principal as well as dependent entity. The principal entity can have zero-or-one association with the dependent entity. Dependent entity can have only one association with Principal entity.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages