Skip to content

Circular References #4646

Description

@capesean

My model is effectively:

public class Project
{
    [Key]
    public Guid ProjectId { get; set; }

    public Guid ClientId { get; set; }
    public virtual Client Client { get; set; }
}

public class Client
{
    [Key]
    public Guid ClientId { get; set; }

    public virtual ICollection<Project> Projects { get; set; } = new List<Project>();
}

Up until I changed to the EntityFrameworkCore, I could fetch Projects with their associated Clients:

DbContext.Projects.Include(p => p.Client);

Since upgrading, I'm getting the error:
Additional information: Self referencing loop detected with type 'Models.Project'. Path 'Client.Projects'.

This should be pretty straight-forward: give me the Projects and their Clients. I don't want the Clients' Projects - else then I could see the issue with the loop.

I've mentioned this here:
aspnet/Mvc#4160

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions