I just trying to Linq query update with join condition
var GsOrderUpdate = (from x in ctxParser.Tbl_Order_Hierarchy
join y in ctxParser.tbl_GS_Related_Orders
on x.RootOrder equals y.RelatedOrder
where y.ParentId == sParentId
select new
{
ID = x.ID,
RelatedOrderParentId = y.ID
});
foreach (var gs in GsOrderUpdate)
{
gs.RelatedOrderParentId = gs.ID;
}
ctxParser.SaveChanges();
I am hetting this error:
Property or indexer Anonymous type RelatedOrderParentId cant be assigned to it is read only.
How can resolve this problem.
RelatedOrderParentIdwhich you are trying to update?.