I have a scenario that does something like the following:
1) Launches a read-only screen with a grid that displays a Customer, including related orders via AddIncludePaths("Orders"). This screen displays a count of the orders in the grid via customer.Orders.Count(), using a value converter.
2) Launches a new screen, with a new entity manager, that allows editing of the Customer and related Orders, where orders can be added or removed and changes are saved.
3) Refreshes the data on the first screen, once finished with the second. The count of orders, however, is not consistent with the changes.
If I start with 2 orders, add 6 and refresh the read only screen, I will get a total of eight orders. If I return to the screen and delete the 6 I just added, and refresh again, the total of 8 remains.
Results are the same, even if I change the QueryStrategy on the first screen to DataSourceOnly.
If I clear the read only screen's entity manager before the refresh, the count is correct.
If I remove the customer and their orders from the read only screen's entity manager and refresh, the count is correct as well.
My guess is DELETED entities are not taken into account when refreshing? What would happen if you deleted an order via SQL Mgmt Studio and attempted a refresh? It seems like it would be possible to use the set of orders retrieved from the data source to determine what has been deleted.
What are the scenarios where it would be desirable to retain the entities in cache, that were deleted from the source?
I'd like to be able to just refresh, bind the datagrid again, and be done.