Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my online exam project there are 4 methods in WCF:

1)GetSections--------------------Select only sections
2)GetExamDetails-----------------Select exam details from db
3)GetQuestionsAndInsert----------Select questions and insert in Exam table
4)UpdateAttempt------------------Update attempts in db

These methods are executed when user click on exam link. When 2 or more users click on that link exam page get load successfully but if 2 users click on same link at same time then any one of then or both get error from above any 1 method. Errors like transaction failed,can not 'read' data while other transaction is running etc.

I used Entity Framework in my project. I know it is concurrency issue but I am not able to resolve it. Please tell me how to manage this problem.

Please reply ASAP.

Thank you.
Posted

1 solution

C#
My problem resolved. I have declared entity object globally so that I got this error. Now I declare separate object in each method and my problem is solved.
 
Explanation : As entity object is globally declared all methods run on same object. They are not able to do operations on database by same object and transaction get failed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900