Yesterday we updated to the latest epi version. We seem to have a problem getting lineitem data from a shipment now.
Before we could use shipment.LineItems to get LineItem objects including all meta data but now we get InMemoryLineItem instead which is not castable to LineItem.
What is the thinking here, that we iterate the lineitems from a shipment, and using the lineitemid to get the real lineitem from the orderform?
What would you do with the LineItems? Note that once you use shipment.LineItems, you enter the realm of abstractions and you should be using abstractions all the way.
In 9.12 it was working fine to for example do a foreach (var lineitem in shipment.LineItems) and get access to lineitem["metafieldname"], lineitem.ListPrice and so on. That's what we've done in our order history feature for example.
I've changed to fetch the "real" lineitem from the orderform to make this work. I think this should be considered a breaking change.
Yes it is indeed a breaking change, as IShipment/ILineItem,etc. were marked as BETA and is supposed to change - until 9.19 when it comes out of BETA.
For your case, I think you should still be able to access such field - both reading and saving via ILineItem.Property
Alright thanks. I didn't realize it was beta. I mean Shipment.LineItems has been around for ages.
I can accept that the underlying implementation is beta, but the property itself which has been around since Mediachase should in my opinion not be. And should not change behavior so it breaks existing implementations.
IShipment.LineItems had been always BETA. Previously there was only OrderForm.LineItems, and then you have to call Shipment.GetShipmentLineItems to get IEnumerable<LineItem> of a shipment.
Alright, thanks for your quick replies :)
Sorry for mixing things up.
Also you dont need to get from the order from. You can just use Shipment.LineItems.First().Properties["ListPrice"] = 99; Then if you call IOrderRepostitory.Save it will sync any of the meta fields to the lineitem implementation.