This is a migrated thread and some comments may be shown as answers.

Issue with IsolatedStorageProvider

14 Answers 151 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marut
Top achievements
Rank 1
Marut asked on 30 Aug 2011, 12:39 AM

Hi,

I am trying to persist the properties of the UI elements (e.g. Sorting, Filtering, Ordering of Columns in RadGridView) using the IsolatedStorageProvider. But, the changes don't seem to persist when changes are done and saved two or more times.

The following code is being used to save:

IsolatedStorageProvider isoProvider = new IsolatedStorageProvider();
isoProvider.SaveToStorage();

Assigned StorageId for the Grid:

telerik:PersistenceManager.StorageId="xyzGrid"

The following code us being used to Load in the constructor:

IsolatedStorageProvider isoProvider = new IsolatedStorageProvider();
isoProvider.LoadFromStorage();

Waiting for a response.

Thanks,
Marut

14 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 31 Aug 2011, 07:35 AM
Hi Marut,

The sorting, filtering, grouping and column settings cannot be directly serialized by the persistence manager. They are strictly connected to the GridView's columns and to be recreated, they require strong reference to the appropriate column. For this, you would have to use the grid view custom property provider. You can see an online demo with this here. Please let me know if you have questions on this.

Greetings,
Alex Fidanov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Marut
Top achievements
Rank 1
answered on 02 Sep 2011, 10:50 PM
Hi Alex,

I have used the same example you have mentioned to set it up (using GridViewCustomPropertyProvider & Proxies). The only change is that I am using IsolatedStorage:
IsolatedStorageProvider isoProvider = new IsolatedStorageProvider();
isoProvider.SaveToStorage();

instead of PersistenceManager:
PersistenceManager manager = new PersistenceManager();
this.stream = manager.Save(this.gridView);

But, that should not be an issue as, my changes (grouping/filtering) are saved for the 1st time, but not when changes are made and saved two or more times.

Waiting for a response.

Thanks,
Marut



0
Tina Stancheva
Telerik team
answered on 06 Sep 2011, 03:00 PM
Hi Marut,

I wasn't able to reproduce this issue. Can you please have a look at the attached solution and let me know if it works for you. And if you can reproduce the issue in it, please list the steps that we can follow to reproduce the issue on our side.

Regards,
Tina Stancheva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Marut
Top achievements
Rank 1
answered on 14 Sep 2011, 06:47 AM
Hi,

After some investigation I found that the root cause of my issue is something else.
I have multiple views (containing a grid each) in my app, which are loaded when I click on the corresponding RadMenuItem.

Now, each of these grids needs the capability for the view changes (filter/sorting/grouping) to be saved.
So, in the constructor of each of these views I have the code that registers the custom persistence provider:
ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>( typeof( RadGridView ), new GridViewCustomPropertyProvider() );

Now, here are the repro steps for the issue:
1. Goto View 1. Filter/Group by a column. Save the view.
2. Refresh the browser. The last saved changes show up fine on View 1.
2. Goto View 2 (by clicking on the RadMenuItem).
3. Go back to View 1 (by clicking on the RadMenuItem). Filter/Group by a column. Save the view.
4. Refresh the browser.
5. The last saved changes don't show-up.

Waiting for a response.

Thanks,
Marut

0
Drew
Top achievements
Rank 1
answered on 15 Sep 2011, 11:46 PM
Hi,

We're seeing a problem related to the version number of assemblies being embedded into the .bin files that are created.  When our automated build versions a new build it breaks the existing .bin files.  Any recommendations?

Thanks,
Drew
0
Alex Fidanov
Telerik team
answered on 16 Sep 2011, 09:24 AM
Hello Drew,

Is it possible to provide more information on this issue?

Thank you.

All the best,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Drew
Top achievements
Rank 1
answered on 16 Sep 2011, 05:35 PM
Sure.  First off, I'm Marut's co-worker so the examples he posted earlier are also relevant to this issue.

We recently added a piece of TFS Build automation that automatically versions the AssemblyInfo.cs (More details).  Afterwards, we started noticing an issue where when we upgraded from one build to the next our settings no longer loaded correctly and during the investigation we noticed that the IsolatedStorageProvider appears to be writing the fully qualified assembly name which contains the version information our build updated (See attached screen shot).  If we manually change the assembly version to be the same everything works again.

We're using the ICustomPropertyProvider interface to save and load RadGridView's as Marut mentioned earlier.

I think you might consider this by design, but I was wondering if there's an easy way to fix this on our end.  Is there any other information you need?
0
Drew
Top achievements
Rank 1
answered on 16 Sep 2011, 10:53 PM
FYI -- We've fixed this for now by versioning one of our assemblies differently and just leaving it marked as 1.0.0.0.
0
Marut
Top achievements
Rank 1
answered on 16 Sep 2011, 11:21 PM
This issue still stands unresolved:

I have multiple views (containing a grid each) in my app, which are loaded when I click on the corresponding RadMenuItem.

Now, each of these grids need the capability for the view changes (filter/sorting/grouping) to be saved.
So, in the constructor of each of these views I have the code that registers the custom persistence provider:
ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>( typeof( RadGridView ), new GridViewCustomPropertyProvider() );

Now, here are the repro steps for the issue:
1. Goto View 1. Filter/Group by a column. Save the view.
2. Refresh the browser. The last saved changes show up fine on View 1.
3. Goto View 2 (by clicking on the RadMenuItem).
4. Go back to View 1 (by clicking on the RadMenuItem). Filter/Group by a column. Save the view.
5. Refresh the browser.
6. The last saved changes (in step 4) don't show-up.

Waiting for a response.

Thanks,
Marut
0
Alex Fidanov
Telerik team
answered on 21 Sep 2011, 09:25 AM
Hi Marut,

Could you please give us more information on your scenario? Is this a modular application (prism)? How are the views loaded - do they represent the content of one control? When a view is activated, does it deactivate the previous one?

What you can do to troubleshoot this is to see which controls are registered in the persistence manager before saving/loading the settings. For this, you can take a look at the result of the PersistenceManager.GetStorage() method.

Moreover, you do not need to register multiple providers. You can do this only once and all of the GridView instances will use this provider throughout the application.

All the best,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Drew
Top achievements
Rank 1
answered on 05 Oct 2011, 06:28 PM
Hi Alex,

We are using Prism and it looks like we're not doing anything special to deactivate our views.  All of our ViewModels implement the IConfirmNavigationRequest interface, but all contain the same boilerplate code:

 

public bool IsNavigationTarget( NavigationContext navigationContext )
{
    return true;
}
  
public void OnNavigatedFrom( NavigationContext navigationContext )
{
   
}
  
 
public void OnNavigatedTo( NavigationContext navigationContext )
{
  
}
  
public void ConfirmNavigationRequest( NavigationContext navigationContext, Action<bool> continuationCallback )
{
    continuationCallback( true );
}


Our initial view contains two RadGridView controls, and our second view contains one RadGridView control.

I've just stepped through the code watching the registered GridView's via the PersistenceManager.GetStorage() call and noticed the following:

  1. Launch application
  2. Observe two RadGridViews are present in the PersistenceManager.GetStorage() call, and via OnNavigatedTo's parameter I can see one view is loaded and one view is active
  3. Switch to the second view
  4. Observe three RadGridViews are present in the PersistenceManager.GetStorage() call (the ones for both views), and via OnNavigatedTo's parameter I can see two views are loaded and one view (the second) is active
  5. Switch back to the first view
  6. Observe one RadGridView is present (just the one from the second view), via OnNavigatedTo's parameter I can see two views are loaded and one view (the first) is active
  7. Try to save
  8. Observe Persistence.GetStorage() returns an empty dictionary

Our save code:

IsolatedStorageProvider isoProvider = new IsolatedStorageProvider();

isoProvider.SaveToStorage();

 

This seems fairly straight-forward.  Any recommendations?

0
Alex Fidanov
Telerik team
answered on 10 Oct 2011, 05:07 PM
Hi Drew,

I am still trying to reproduce this behavior. Which version are you using to test this? I recall making some changes around registering and unregistering objects with the store after the official release. With the latest version, an object is registered in the store when it has been initialized (the StorageId property is set) and unregistered in its Unloaded event. What could be happening is that the Unloaded event of these GridViews is raised and therefore the object is unregistered. Can you confirm that this is the case in your scenario - when switching views?

Best wishes,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Drew
Top achievements
Rank 1
answered on 10 Oct 2011, 07:39 PM
Hi Alex,

It looks like that may be the root cause.  I see the two grids registered correctly the first time the Loaded event fires, then the Unload event fires and the grids are missing, and on returning to the page the Loaded event fires again, but this time there are no grids present in the PersistenceManager.GetStorage() call.

Thanks,
Drew
0
Alex Fidanov
Telerik team
answered on 11 Oct 2011, 05:34 PM
Hi Drew,

I have acknowledged this as an issue with the store. I have logged this in our PITS under "Unloaded objects are not registered back to store when loaded" and have updated your points.

Objects are registered in the store only when their StorageId property is set. In their Unloaded event, they are unregistered (to avoid memory leaks). It seems that the module application only removes the view from the visual tree and then adds it again, without recreating it. This is why, the objects in that view are not registered back to the store.

As a way around this behavior, you can reset the StorageId in the Loaded event of the view - set it to null and then back to the original value. This will force the property changed mechanism to register the object back in the store.

All the best,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Marut
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Marut
Top achievements
Rank 1
Tina Stancheva
Telerik team
Drew
Top achievements
Rank 1
Share this question
or