C# EF查询获取导航不可达警告的包含操作

C# EF查询获取导航不可达警告的包含操作,c#,entity-framework,C#,Entity Framework,我有一个简单的问题 clients = _context.Clients .Include(e => e.TrainerClients) .Include(e => e.User) .Where(e => e.TrainerClients.All(f => f.Status == UserStatus.Linked)); 这将返回: 但如果按原样执行,我会

我有一个简单的问题

            clients = _context.Clients
               .Include(e => e.TrainerClients)
               .Include(e => e.User)
               .Where(e => e.TrainerClients.All(f => f.Status == UserStatus.Linked));
这将返回:

但如果按原样执行,我会收到一条警告消息:

The Include operation for navigation '[e].User' is unnecessary and was ignored because the navigation is not reachable in the final query results.
但是,如果我从查询中注释掉Include(e=>e.User),我不会得到警告,但也不会得到用户数据

那么,为什么我会得到这个警告,我如何改进我的查询以不得到警告呢

更新: 客户机型号:

public class Client : BaseModel
{
    public string UserId { get; set; }
    [ForeignKey(nameof(UserId))]
    public ApplicationUser User { get; set; }    
    public DateTime LastPaidDate { get; set; }
    public string CreditCardNumber { get; set; }

    public ICollection<TrainerClient> TrainerClients { get; set; }
}
培训客户:

public class TrainerClient : BaseModel
{
    public int TrainerId { get; set; }
    [ForeignKey(nameof(TrainerId))]
    public Trainer Trainer { get; set; }

    public int ClientId { get; set; }
    [ForeignKey(nameof(ClientId))]
    public Client Client { get; set; }

    public Enum.UserStatus Status { get; set; }

    public Enum.RequestType RequestType { get; set; }

    public string RequestDate { get; set; }
}

你有两个表1)用户2)客户端吗?然后按Id连接这两个表。我有一个clients表,它具有到trainerclient和clients的导航属性。我的印象是,如果我只使用include,它会在查询中提取数据,这就是我想要的…只是不想要警告。在此页面中,您可以向我们展示链接表的模型生成器吗?使用模型更新显示您完成了查询吗?您是否有两个表1)用户2)客户端?然后按Id连接这两个表。我有一个clients表,它具有到trainerclient和clients的导航属性。我的印象是,如果我只使用include,它会在查询中提取数据,这就是我想要的…只是不想要警告。从本页,您可以向我们展示链接表的模型生成器吗?使用modelsHow更新?您可以完成查询吗?
public class TrainerClient : BaseModel
{
    public int TrainerId { get; set; }
    [ForeignKey(nameof(TrainerId))]
    public Trainer Trainer { get; set; }

    public int ClientId { get; set; }
    [ForeignKey(nameof(ClientId))]
    public Client Client { get; set; }

    public Enum.UserStatus Status { get; set; }

    public Enum.RequestType RequestType { get; set; }

    public string RequestDate { get; set; }
}