I have two entities: Product and StockItem.
When I insert a product - I have to update the relevant StockItem.
When I delete a product - I have to update the relevant StockItem as well.
My problem is updating the stock item in case of product update (modification). In order to update the relevant StockItem, I need to know if a field named Group in the Product entity has changed. To do so I have to compare between the modified version of the entity and the unmodified version of the entity. But whenever I ask for the entity - the entity framework returns the attached entity (and not the old one from the database).
How can I ask the entity framework to return the old version / current db version of the entity (before change)?