Hello,
I have the following problem:
I do an MVVM silverlight application consuming data from a RIA web service (OpenAccessDomainService)
I have two views created in a PRISM region, one is active the other is hidden I can toogle between them.
Both views will use view models exposing a Products collection declared as QueryableDomainServiceCollectionView<Product>
ViewA will bind the Products collection to a RadDataGrid - here I can add, edit or remove Products
ViewB will bind the Products into a combo box allowing one product selection as a property of another type of entity.
My goal is to operate changes in both views and then submit all changes at once on the server.
I had the following approach...
I was thinking to use a single (shared - singleton) DomainContext on the constructor call of the two ODSC<Product> memebers in the two view models, to be able to gather changes in all views in a single submitable DomainContext. This seems to work however the ODSC<Product> instances seems not to sync with the shared DomainContext. I mean if I add new products in the ViewA (using RadDataGrid) then those changes will be propagated in the DomainContext, however the ODSC in ViewB's view model will not be aware about the new products.
Is there a way to resync the ODSC only with the data available in the local DomainContext? without reloading from the server? Even if I will reload from server it will not work because the added products are still pending submision to the server.
This could be somehow addressed by using a shared ODSC<Product>, but this will only solve only this simple case I encountered, there are more complex situations with different filters on views bound to different controls so using shared ODSC will not work always, I need a way to refresh somehow the ODSC instances when changes occurs in data context.
I appreciate any ideea, or references to architetcure & design "papers" exlaining how this type of requirement can be designed.
Vasile
I have the following problem:
I do an MVVM silverlight application consuming data from a RIA web service (OpenAccessDomainService)
I have two views created in a PRISM region, one is active the other is hidden I can toogle between them.
Both views will use view models exposing a Products collection declared as QueryableDomainServiceCollectionView<Product>
ViewA will bind the Products collection to a RadDataGrid - here I can add, edit or remove Products
ViewB will bind the Products into a combo box allowing one product selection as a property of another type of entity.
My goal is to operate changes in both views and then submit all changes at once on the server.
I had the following approach...
I was thinking to use a single (shared - singleton) DomainContext on the constructor call of the two ODSC<Product> memebers in the two view models, to be able to gather changes in all views in a single submitable DomainContext. This seems to work however the ODSC<Product> instances seems not to sync with the shared DomainContext. I mean if I add new products in the ViewA (using RadDataGrid) then those changes will be propagated in the DomainContext, however the ODSC in ViewB's view model will not be aware about the new products.
Is there a way to resync the ODSC only with the data available in the local DomainContext? without reloading from the server? Even if I will reload from server it will not work because the added products are still pending submision to the server.
This could be somehow addressed by using a shared ODSC<Product>, but this will only solve only this simple case I encountered, there are more complex situations with different filters on views bound to different controls so using shared ODSC will not work always, I need a way to refresh somehow the ODSC instances when changes occurs in data context.
I appreciate any ideea, or references to architetcure & design "papers" exlaining how this type of requirement can be designed.
Vasile