小编Clu*_*tch的帖子

Linq to Entities子查询填充数组?

linq的新手试图解决这个问题.我有以下表格:

Customer: Cust_Id, Name

Orders: Order_Id

CustomerOrders: Cust_Id, Order_Id

我有一个这样的课:

public class Customers
{
public List<Row> Rows { get; set; }

public Customers()
    {
        Rows = new List<Row>();
    }


    public class Row
    {
       public int Key { get; set; }
       public string Name { get; set; }
       public List<string> Order_Ids { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

Linq查询是这样的:

var query = from c in context.Customer
select new Customers.Row
{
    Key = c.Cust_Id,
    Name = c.Name,
    Order_IDs = List<string>( ?? )
}; …
Run Code Online (Sandbox Code Playgroud)

c# linq asp.net linq-to-entities

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

标签 统计

asp.net ×1

c# ×1

linq ×1

linq-to-entities ×1