locked
The best way to store produced data by Metro Style App. RRS feed

  • Question

  • Hi all, I have got a question concerning best practises in case of storing data.

    My application will collect some data from the user and I would like to store it in the file system, this will be a simple list of entries and I would like to store such list in one file. Later during work with my app, user will add new data so new entries will be added to this file. This data will be not a lightweight settings (or something like this) so 'roam the cloud' is not in use here.

    I was thinking that the easiest way will be to keep my file in one of the Known Folders. I have checked the 'App capability declarations' and I have decided that the best place for my app data file will be the Documents Library. But the problem is that such capability requires the 'File Type Associations' declaration - and I do want to achieve such case that when user will double click a file with given extension it will by default run my app. So I am not sure about such approach.

    What else may I do to achieve such functionality? Or maybe I should ignore the fact that my app will be open by files with given extension and I should go with the Documents Library? Thank you for help.




    • Edited by klcikrras Tuesday, July 31, 2012 6:01 AM
    Tuesday, July 31, 2012 5:51 AM

Answers

  • Just a quick info about local storage. There is a difference between, ApplicationData.LocalFolder and ApplicationData.RoamingFolder. The "roam to the cloud" that you mentioned, only applies to RoamingFolder.

    If the user will be accessing the file only through your application, I don't see a reason to store in Documents Library. I would go with the local storage.


    Can Bilgin
    Blog CompuSight

    • Marked as answer by klcikrras Tuesday, July 31, 2012 6:22 AM
    Tuesday, July 31, 2012 6:01 AM

All replies

  • Just a quick info about local storage. There is a difference between, ApplicationData.LocalFolder and ApplicationData.RoamingFolder. The "roam to the cloud" that you mentioned, only applies to RoamingFolder.

    If the user will be accessing the file only through your application, I don't see a reason to store in Documents Library. I would go with the local storage.


    Can Bilgin
    Blog CompuSight

    • Marked as answer by klcikrras Tuesday, July 31, 2012 6:22 AM
    Tuesday, July 31, 2012 6:01 AM
  • Yes, my app will read the content of that file, display it on the device screen and give the possibility to add new entries. Thank you for that tip. Please confirm if I am right. This local storage is a folder dedicated to particular user, which will be not changed between user sessions?
    Tuesday, July 31, 2012 6:08 AM
  • You are correct. It is per-user storage. Quoting the documentation:

    "When an app is installed, the system gives it its own per-user data stores for application data such as settings and files. You don't need to know where or how this data exists, because the system is responsible for managing the physical storage. Just use the application data API, which makes it easy for you to work with your application data."


    Can Bilgin
    Blog CompuSight

    Tuesday, July 31, 2012 6:17 AM