This question is locked. New answers and comments are not allowed.
Dear Support,
Please help us resolve this below scenario.
we have 2 tables Order and OrderItems which is in One to Many relationship
lets say Order table is PO10000 and Order Item table is PO10001, then the navigation property to PO10001 will be generated like below and it is read-only, Even if we add Set for this property, it will get overwrite whenever the model changes. Can we have a permanent solution for this.
The basic idea to make this read-only is when we query PO10000 table, PO10001 should be fetched based on a filter condition and Order-by. Please find the query below.
We would appreciate if you can even provide query that resolves this problem.
Thanks,
Arun
Please help us resolve this below scenario.
we have 2 tables Order and OrderItems which is in One to Many relationship
lets say Order table is PO10000 and Order Item table is PO10001, then the navigation property to PO10001 will be generated like below and it is read-only, Even if we add Set for this property, it will get overwrite whenever the model changes. Can we have a permanent solution for this.
private IList<
PO10001
> _pO10001 = new List<
PO10001
>();
public virtual IList<
PO10001
> PO10001
{
get
{
return this._pO10001;
}
}
The basic idea to make this read-only is when we query PO10000 table, PO10001 should be fetched based on a filter condition and Order-by. Please find the query below.
Order = (from c in dbContext.PO10000
where c.PRCHO_NUMBER.ToUpper() == pRchoNumber.ToUpper() && c.ARCHV_FLAG == char.Parse("N")
select c).FirstOrDefault();
Order.PO10001 = purchaseOrder.PO10001.OrderBy(p => p.PO10001_ID).ToList();
Order.PO10001 = purchaseOrder.PO10001.Where(p => p.ARCHV_FLAG == char.Parse("N")).ToList();
return purchaseOrder;
We would appreciate if you can even provide query that resolves this problem.
Thanks,
Arun