我想离开连接两个表并总结一个字段,所以我做了这个查询:
IQueryable_qRequester = from a in dbErp.EPROC_TR_ER_DETAIL join b in dbErp.EPROC_TR_INVENTORY on new Reference.Inventory.SearchDetailRequester { ID_REQUEST = a.ID_REQUEST , ID_KATALOG = a.ID_KATALOG} equals new Reference.Inventory.SearchDetailRequester { ID_REQUEST = b.ID_REQUEST, ID_KATALOG = b.ID_KATALOG } into inv_join from c in inv_join.DefaultIfEmpty() where a.ID_REQUEST == ID_REQUEST && a.APROVE_BY_DS == 1 && a.APROVE_BY_GS == 1 select new Reference.Inventory.SearchDetailRequester { ID_KATALOG = a.ID_KATALOG, TYPE_OF_GGS = a.TYPE_OF_GGS, TRANSACTION_TYPE = "OUT", DATE = c.DATE ?? "", QTY = -1 * c.QTY ?? a.QTY, ID_INVENTORY = c.ID_INVENTORY, QTY_AVAILABLE = ((from d in dbErp.EPROC_TR_INVENTORY where d.ID_KATALOG == a.ID_KATALOG group d by new { d.ID_KATALOG } into e select new { qty_ava = (System.Int32)e.Sum(p => p.QTY ?? 0) }).FirstOrDefault().qty_ava) };
但是当我调试时,我收到了这条消息:
"Reference.Inventory.SearchDetailRequester"类型出现在单个LINQ to Entities查询中的两个结构不兼容的初始化中.可以在同一查询中的两个位置初始化类型,但前提是在两个位置都设置了相同的属性,并且这些属性以相同的顺序设置.
有人可以帮忙吗?