locked
How to make global applicatio variables persistent through sessions? RRS feed

  • Question

  • Hi, first of all thanks for the terrific job.

    I am trying to write a test application and I am stuck with a problem: my app needs some initialization variables to be set at runtime and persisted somewhere so they will be available thorugh sessions; something you could put in a .ini file. What's the preferred approach with LS?

    Thank'you

    Andrea

    Thursday, January 6, 2011 11:38 PM

Answers

  • You can use Lifeng's method of persisting information across sessions by creating another entity to store this information. Using the entity approach with make the data available to all clients, no matter what machine the client application is running on. This sounds like what you would want to do.

    An alternative is to use Silverlight's isolated storage. Isolated storage allows you to persist information on a per user per machine basis. This is great for storing settings that are not needed if the same user opens the application on a different machine, such as saving the height and width of the window. The down side to using isolated storage is that you should not assume that if the application writes something to isolated storage that it is guaranteed to be there in the future. For more information about isolated storage, check out this quickstart tutorial .

    Tuesday, January 25, 2011 8:55 AM

All replies

  • Hi, tnx for your answer. Yes, that solves part of the problem, but now I have to store 4 or 5 values that the user will have to assign at run time, so they can't be hard coded in the source file. TO be more precise, they are 5 dates that mark the beginning of the year, the start of 4 definite periods during the year, and the end of the year. I will need those values in my app both for validating and filtering.

    thanks in advance to those who are going to help :-)

     

    Andrea

     

    Saturday, January 8, 2011 12:35 AM
  • Maybe you can create a database entity and just save those values in the database.


    LLF
    Monday, January 10, 2011 6:48 PM
  • You can use Lifeng's method of persisting information across sessions by creating another entity to store this information. Using the entity approach with make the data available to all clients, no matter what machine the client application is running on. This sounds like what you would want to do.

    An alternative is to use Silverlight's isolated storage. Isolated storage allows you to persist information on a per user per machine basis. This is great for storing settings that are not needed if the same user opens the application on a different machine, such as saving the height and width of the window. The down side to using isolated storage is that you should not assume that if the application writes something to isolated storage that it is guaranteed to be there in the future. For more information about isolated storage, check out this quickstart tutorial .

    Tuesday, January 25, 2011 8:55 AM