Click below for Step by Step and Interview Q & A (dotnetinter) wrote,
Click below for Step by Step and Interview Q & A
dotnetinter

How can we handle concurrency in Entity framework? ( .NET Entity framework interview questions)

Before this the interviewer can ask you what is concurrency ?. You can read about concurrency from http://questpond.over-blog.com/article-can-you-explain-the-term-concurrency-c-interview-questions-with-answers-120291637.html

In EF concurrency issue is resolved by using optimistic locking. Please refer ADO.NET chapter for what is optimistic locking and pessimistic locking?. To implement optimistic locking right click on the EDMX designer and set the concurrency mode to “Fixed” as shown in the below figure.

                                            liv1

Now whenever we have concurrency issues you should get “OptimisticConcurrencyException” error as shown in the below figure. You can then put a try / catch  to handle this situation.
                                            liv2

Below is a great ADO.NET Entity framework interview question video created by www.questpond.com which shows how to do CRUD using Entity framework.

Tags: c# entity framework interview questions, concurrency interview questions, csharp interview questions, information technology questions, optimistic and pessimistic locking inter, programming interview questions
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments