Web Technologist
ObjectTrackingEnabled – LINQ
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;
}
| Print article |
Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

