Linq组join不会创建Hierarchy

时间:2015-09-29 11:49:02

标签: entity-framework linq

我需要按照它返回我的方式修复Linq

     Class Result 
    {
        int factoryId;
        string Name,
        string address,
        List<Image> Images

    }

如果我删除“group into”,它会让我得到平坦的结果。如果我将组添加到其中会抛出异常,表示无效的列photo_2。我班上没有这样的专栏。

      var context= new MyContext();
        var data = from fac in context.Factory
            join prod in context.FactoryProducts on fac.factoryId equals Prod.factoryId
            join prodsample in context.ProductSample on fac.factoryId equals prodsample.factoryId
            join img in context.CatalogImages on img.PhotoId equals prodsample.PhotoId into img
                   where fac.factoryId == 001

            select new
            {
                fac.factoryId,
                fac.Name,
                fac.address,
                Images=img

            };

0 个答案:

没有答案