The EF Core uses the mechanism internally for creating relationship between entities based on the following scenarios:
- If the two entities have navigation properties pointing to each other; EF will configure them as inverse navigation properties
In the following code, the Posts property of the Blog entity and the Blog property of the Post entity would be configured as inverse navigation properties:
public class Blog{ // Code removed for brevity public ICollection<Post> Posts { get; set; } }public class Post{ // Code removed for brevity public Blog Blog { get; set; }}
The following image illustrates the relationship created based on the navigational properties:
- EF will consider the property ...