Print Page | Close Window

After modifying a view, I cannot get the persistence manager to refresh the grid.

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=307
Printed Date: 27-Mar-2025 at 8:15pm


Topic: After modifying a view, I cannot get the persistence manager to refresh the grid.
Posted By: Customer
Subject: After modifying a view, I cannot get the persistence manager to refresh the grid.
Date Posted: 16-Jul-2007 at 3:47pm
My current problem is as follows.
 
I have one binding source that is bound to a class that represents an SQL view. The SQL view (say, vwParent) is the parent in a parent|child relationship with another SQL view (vwChild). The views share 3 key fields and I have specified the relationship in the object mapper. I have two XtraGrid objects. One for the parent and one for the child. The parent grid is bound to the binding source with no datamember defined and the child grid is bound to the data source and has the datamember set to the child view vwChild. 
 
Navigating around the parent grid will trigger display updates in the child grid and all looks as I want it. The problem I am having is that when I modify a row in one of the component tables of the parent view (vwParent), I cannot get the persistence manager to refresh the grid. I should stress that the changes are actually saved to the database though and if I restart my application and view the grids again, the modification to the data is shown.
 
So, can you please help me to get the grids to be refreshed when I modify rows from the SQL view's underlying tables? I have looked through the ibrunner forum and seen that it is suggested to use the RefetchEntities and GetEntities methods. I have tried each method without success, in particular "pm.GetEntities<DB.vwParent>(QueryStrategy.DataSourceOnly);".  



Replies:
Posted By: IdeaBlade
Date Posted: 16-Jul-2007 at 3:50pm
The problem is that "vwEquipment" isn't a live view in the cache - DevForce treats it like any other entity and doesn't know that the underlying data has changed.  Just today I was pondering whether the EntityListManager could be used in these kinds of situations, but I haven't explored this further yet.  Meanwhile, if you have a vwEquipment - Equipment relationship, when an Equipment object changes you could call a ForcePropertyChanged on the related vwEquipment object.  This should cause the grid displaying the vwEquipment info to refresh.  If this isn't sufficient and you also need to pick up any new or deleted items from the DB, then you might want to issue another GetEntities call for vwEquipment with a fetch strategy of DataSourceOnly.  How you'd "trigger" this would be at your discretion...


Posted By: Customer
Date Posted: 16-Jul-2007 at 3:51pm
Thank you for your help, I am now trying things the "DevForce way" and not using views. 



Print Page | Close Window