Bobby Sharma wrote:Hi there, I am building a test engine in MVC and want to add a functionality in which user session should not be killed i.e. suppose a person undergoing a test, suddenly faced a powercut, and when the power comes back , he or she should go back to the state at where they was interrupted by power-cut. The session should be resumed where he or she left the test. I am not asking for any code, just hints as I have no idea how to achieve this. Prometric test engine have this functionality already.
I used a Model class to represent a user/test combination. This class contains everything needed to identify the state of the test - answers to questions already done, whether or not test has been graded yet etc.
Also this Model class is serializable and each user/test combination has a unique ID which must be in text suitable for use as a file name.
The Model class object is serialized to disk after every significant action, keeping a copy in memory if possible.
If the user drops the connection and reconnects, the unique id can be used to recover the state he was in last.
Now you may think that serializing the object to disk frequently is slow, I can assure you that it is not compared to everything else going on.
MVC orientation will help in all aspects of creating a Test engine.
Bill