Model Tracking In Entity Framework

We were using Microsoft WCF Web Services and Entity Framework ORM in our project.

When client call each Web Services,Entity Framework keep state of each model in memory for tracking model state for each client. In this case memory usage will going up extremely in server.We don't need to tracking model in client side so we set MergeOption to NoTraking in client,But it seems not working.

Is there any option for this problem?

Answers


You can use the .AsNoTracking() method - this means that Entity Framework won't try to keep track of any changes to the entities. Example:

var items = context.Foo.AsNoTracking();

Recommended reading:

Entity Framework and AsNoTracking


Need Your Help

jpql (NamedQuery) subquery not working with parameter

java jpa jpql named-query

I'm using JPQL and a NamedQuery to query the database in a combined question.

help with a PHP regex to extract text around a string

php regex

I am trying to use a regular expression and it's just breaking my brain. I'll think I have it and the the script just breaks. I need to try to give people a way to report their location via SMS. I...