Search code examples
c#linqlinq-to-sqlwhere-clausesubmitchanges

SubmitChanges internally adds all the fields as where clause, how to get rid of it


I have a table in database with a primary key say emp_pk. Now using LINQ I am trying to perform some operations on it. When I change few properties and call,

context.SubmitChanges();

ideally the where clause should contain where emp_pk = value.

But when I review the query from SQL profiler, I see lot of conditions in where clause, which I believe are generated by LINQ engine. This is causing a major performance issue.

Can anyone please help me in this case to optimize the query?


Solution

  • That's because optimistic concurrency check is enabled. You can turn it off per column by setting Update Check=never per column in the dbml designer