Reputation: 913
I Have a blank UWP Application, I wrote some setting in ApplicationData , when I increase My package version, My applicationData version doesn't change. another problem is when I set my AppData version with SetVersionAsync method and after that I read setting from myAppData, it reads latest setting that has been wirtten while I am expecting not to read the latest because the version is different. can somebody tell me why?
Upvotes: 2
Views: 449
Reputation: 17855
I don't think you're approaching the application data versioning correctly. There is no direct correlation between the package version and the application data version. The point of application data versioning is to allow changes to the format you're using for application data between application versions.
This is the typical scenario:
0
. You keep doing this until you need to change the format of the data you are saving.ApplicationData.Version
. If its value is 0
, you will use the old code for loading the data. Once you're done, you will call ApplicationData.SetVersionAsync
, set the version to 1
and save the loaded data in the handler according to the new format. The next time your application loads, the application data version will be 1
and you will use the new code to load it.ApplicationData.SetVersionAsync
with the latest value for the application data version.Upvotes: 7