小编Mar*_*the的帖子

然后包含不适用于实体框架LINQ查询

我有一个这样的数据库模型:

public class Customer
{
    public int CustomerId{ get; set; }

    public int OrderId { get; set; }
    public ICollection<Order> Orders { get; set; }
}

public class Order
{
    public int OrderId { get; set; }
    public int Amount { get; set; }

    public int ProductId { get; set; }
    public Product Product { get; set; }
}

public class Product
{
    public int ProductId { get; set; }
    public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

因此,我们有一个可以下订单的客户。该订单包括产品,其中包括名称。我现在正尝试使用linq语句返回完整的模型,如下所示:

_db.Customer.Include(c …
Run Code Online (Sandbox Code Playgroud)

c# linq entity-framework-core

5
推荐指数
1
解决办法
5765
查看次数

标签 统计

c# ×1

entity-framework-core ×1

linq ×1