I have commonFields class in my application. this is online asp.net mvc application of simple test/exam. suppose student have logged in with his credentials. he got select test, and said load it.it will load test in some controller, each test have set of questions. now with this test id i get the list of questions of that particular test. and stored in commonfield class’s
public static List<Question> questionList;
object. due to static it will as it is for application. but if same time another student get logged in and performing the same or different test. then his selected test’s question will stored into again in the questionList object (same as above).
same like say 100’s of student performing test. then what impact will be on questionList? will it always need to instantiates? in commonField class? how to manage this? or due to static CLR will manage it ?
You should store common data in the
Applicationobject and the per-student data inSession.At some point, once per session:
and then whenever you need it:
Your
staticvariable is not reliable, won’t scale to multiple servers and it certainly won’t allow a different questionList for each student.