My English is not good, so i just can describe the problem i got as what as I can. I got 2 entities which are WORK_ORDER and INVENTORY_TRANS, and i have join these tables for querying, before I do the table splitting on WORK_ORDER, everything is working fine. in some reason, i have to do table splitting on WORK_ORDER, and after that, the join query is not working anymore.
i have pasted the code snippet below:
query = from w in context.WORK_ORDERV7
join iv in context.INVENTORY_TRANS on
new { WO = w.BASE_ID, LOT_ID = w.LOT_ID, SPLIT_ID = w.SPLIT_ID, SUB_ID = w.SUB_ID } equals
new { WO = iv.WORKORDER_BASE_ID, LOT_ID = iv.WORKORDER_LOT_ID, SPLIT_ID = iv.WORKORDER_SPLIT_ID, SUB_ID = iv.WORKORDER_SUB_ID }
where w.STATUS != "C" && System.Data.Entity.DbFunctions.TruncateTime(iv.TRANSACTION_DATE) == System.Data.Entity.DbFunctions.TruncateTime(DateTime.Now)
&& iv.WORKORDER_TYPE == "W" && iv.TYPE == "O" && iv.CLASS == "I"
orderby iv.CREATE_DATE descending
select new WOInProgressReference
{
LastPartIssued = iv.PART_ID,
Part = w.PART_ID,
LastPartIssuedDateTime = iv.CREATE_DATE,
UserID = iv.USER_ID,
Warehouse = iv.WAREHOUSE_ID,
WO_Lot_Sub_Split = w.BASE_ID + "," + w.LOT_ID + "," + w.SUB_ID + "," + w.SPLIT_ID
};
The error I got which is about the PART=w.PART_ID, this field is renamed to PART_ID2(i used the sql profiler for tracing). I don't know why after I do the table splitting, then the name is changed.BTW, i have tried other fields, everything is working fine except the column name is same with the join table.
Any help would be appreciated.