1
kudos
spam Kudos Remove

Entity Framework - MergeOption.NoTracking and CompiledQuery.Compile

published 755 days, 15 hours, 50 minutes ago posted by sasa 765 days, 3 hours, 16 minutes ago
Tuesday, January 12, 2010 10:30:47 PM GMT Sunday, January 03, 2010 11:05:21 AM GMT

 

Two things that people tell you about Entity framework performance are, use the Compiled Queryies and potentially remove tracking when its not needed. You can achieve this by using the CompiledQuery.Compile function to obtain a function that is your compiled query and to set the MergeOption of the relevant entities on the ObjectContext.

I've just finished banging my head against a wall when trying to assess the performance of these together.

This was my simple code. Create a static readonly function that is the compiled query and then in by test function checking the status of a check box to set the MergeOption to MergeOption.NoTracking.

category: News | clicked: 7 | | source: sqlblogcasts.com | show counter code
tags: Entity framework, Performance, Query Tuning, Tips and Tricks

No comments yet, be the first one to post comment.

To post your comment please login or signup