New Posts New Posts RSS Feed: After modifying a view, I cannot get the persistence manager to refresh the grid.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

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

 Post Reply Post Reply
Author
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Topic: After modifying a view, I cannot get the persistence manager to refresh the grid.
    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);".  
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Posted: 16-Jul-2007 at 3:51pm
Thank you for your help, I am now trying things the "DevForce way" and not using views. 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down