Web Technologist
Archive for February, 2010
ObjectTrackingEnabled – LINQ
Feb 18th
You may come across a requirement, where you will retrieve data only for reading. LINQ monitors the changes, which as you might have guessed is the not the best solution everywhere, especially in the above scenario.
Here is a quick tip to increase the performance by disabling object tracking in LINQ using the ObjectTrackingEnabled property. This will turn off the unnecessary identity management of the objects.
using (NorthwindDataContext dbContext = new NorthwindDataContext())
{
dbContext.ObjectTrackingEnabled = false;
}

