Hi everyone.
I am developing my first WP application and have a question of how to handle future updates. I hope some seasoned WP devs can help me out.
The application I am developing uses isolated storage DB to store some data that the user can read through and if they like mark as a favorite which they can go through at any time. These changes are saved back to the DB.
When the application is first executed, I call code to check if the DB exists, if NOT the DB is created and the DB is loaded with some initial data from an XML file. At the end I delete the XML file and am left with a populated DB with all the initial data that the user can browse through each record and mark as favorites. So far all of this is working nicely.
The dilemma I have is how to handle future updates of the application where I will likely add more records to the DB. I don?t want to rebuild an existing DB each time the users executes the application after an update which would overide the records they have marked as favorite.
I need a nice way to ensure that existing users can upgdrade to the newest version and get the latest data appended to the DB while leaving existing records in place and of course new users will need to have all the initial data plus updated data loaded into the DB when the application first executes and the DB is created.
To describe my situation using a example: A existing user upgrades my app from V1.0 to V1.1 and I have added extra records to the XML file that I want appended to the existing DB already loaded with data on the users phone.
I can't drop and re-create the DB and load the data back into it each time the users updates my appliation to a new version as the users changes will be lost each time.
So far the best solution I can come up with is:
1. User installs the application and the first time it is run, a process checks to see if the DB exists. If not, it creates the DB and then loads the DB with the initial data from an XML file stored in a folder called InitialData. When the data is loaded in the DB I delete the XML file from the InitialData folder.
2. A second process executes each time the application loads to check if any updated data files exist in the UpdateData folder which are to be appended to the DB. If so the updated data is loaded and data from the XML file appended to the DB. Again at the end the XML file can be deleted.
3. When the user upgrades to V1.1, and the application loads, it will check to see if the DB exists (as above in step 1). In this instance, the DB will still exists on the users phone with all the initial data loaded so there will be no need to create the DB and load the InitialDB from the InitialData folder. As per step 2 above a process will begin to check if any additional files exists in the UpdateData folder. If it does, the system will load the XML files and append the records to the end of the existing DB, thus not overriding existing records in the system, and of course loading the extra records to the DB.
Any future versions of the application will simply continue to add files to the UpdateData folder so that:
1. New users will always get the initial data (when the application first executes as per step 1) plus the extra data found in the UpdateFolder (as per step 2).
2. Existing users will simply load any new update data file found in the UpdateData folder to their existing DB.
Now the initial data will need to be cumulative meaning that each new version will contain all the data from previous versions in the initial data XML file to be loaded into the DB when it is created. e.g v1.2 will contain the initial data from v1.0 plus the updated data from v1.1.
This is so that updating users don't keep loading updated data file to the DB that the would already have, while new users get all the initial data in one go.
I have run this through and it seems OK, but perhaps their is a better way.
thanks.
I am developing my first WP application and have a question of how to handle future updates. I hope some seasoned WP devs can help me out.
The application I am developing uses isolated storage DB to store some data that the user can read through and if they like mark as a favorite which they can go through at any time. These changes are saved back to the DB.
When the application is first executed, I call code to check if the DB exists, if NOT the DB is created and the DB is loaded with some initial data from an XML file. At the end I delete the XML file and am left with a populated DB with all the initial data that the user can browse through each record and mark as favorites. So far all of this is working nicely.
The dilemma I have is how to handle future updates of the application where I will likely add more records to the DB. I don?t want to rebuild an existing DB each time the users executes the application after an update which would overide the records they have marked as favorite.
I need a nice way to ensure that existing users can upgdrade to the newest version and get the latest data appended to the DB while leaving existing records in place and of course new users will need to have all the initial data plus updated data loaded into the DB when the application first executes and the DB is created.
To describe my situation using a example: A existing user upgrades my app from V1.0 to V1.1 and I have added extra records to the XML file that I want appended to the existing DB already loaded with data on the users phone.
I can't drop and re-create the DB and load the data back into it each time the users updates my appliation to a new version as the users changes will be lost each time.
So far the best solution I can come up with is:
1. User installs the application and the first time it is run, a process checks to see if the DB exists. If not, it creates the DB and then loads the DB with the initial data from an XML file stored in a folder called InitialData. When the data is loaded in the DB I delete the XML file from the InitialData folder.
2. A second process executes each time the application loads to check if any updated data files exist in the UpdateData folder which are to be appended to the DB. If so the updated data is loaded and data from the XML file appended to the DB. Again at the end the XML file can be deleted.
3. When the user upgrades to V1.1, and the application loads, it will check to see if the DB exists (as above in step 1). In this instance, the DB will still exists on the users phone with all the initial data loaded so there will be no need to create the DB and load the InitialDB from the InitialData folder. As per step 2 above a process will begin to check if any additional files exists in the UpdateData folder. If it does, the system will load the XML files and append the records to the end of the existing DB, thus not overriding existing records in the system, and of course loading the extra records to the DB.
Any future versions of the application will simply continue to add files to the UpdateData folder so that:
1. New users will always get the initial data (when the application first executes as per step 1) plus the extra data found in the UpdateFolder (as per step 2).
2. Existing users will simply load any new update data file found in the UpdateData folder to their existing DB.
Now the initial data will need to be cumulative meaning that each new version will contain all the data from previous versions in the initial data XML file to be loaded into the DB when it is created. e.g v1.2 will contain the initial data from v1.0 plus the updated data from v1.1.
This is so that updating users don't keep loading updated data file to the DB that the would already have, while new users get all the initial data in one go.
I have run this through and it seems OK, but perhaps their is a better way.
thanks.