views:

88

answers:

1

I'd like to know if it's necessary to compile linq queries to the subsonic entities?

For example would I'd need to compile the following linq query?

var comments = from a in All()
                           where a.ParentCommentId == ArticleCommentId
                           select a;
+1  A: 

Compiled queries are an optional optimization that allow you avoid parsing an expression tree multiple times. It's never required, but may be necessary to meet your performance requirements.

dahlbyk
I should mention that the cost can be quite significant unexpectedly. Any place where a query is invoked in a loop may need either refactoring or compiling the queries in the loop. Otherwise a tiny innocent-looking query invoked a mere 10 times may suddenly give you a 0.5 second delay in the user interface.
romkyns