I am currently using the Self Tracking entities of the .NET Entity Framework, however I would like to speed up my execution of queries.
The first thing everyone seems to suggest is generate the views for the model at compile time.
Using the ssdl files etc, I was able to create a ‘MyModel.Views.cs’, which is compiled in my project. However I saw no benefit of this this what so ever? Am I missing something here? Do I get no benefit from this if I am using Self Tracking entities?
What other ways can I increase performance with the Entity Framework?
How can I create Pre Compiled views, but supply with with parameters? A search query for example needs to take various different parameters, but could do with being made quicker!
Thanks
Well, remember that pre-generated views only help for certain operations. They help for queries which are built by the Entity Framework itself. For example, if you do a
Loadon a related property, a pre-generated view will be used if it’s available. If, on the other hand, you are doing projection or a customWherecall, the pre-generated views cannot be used, since they do not represent your custom query. So it depends upon what you’re doing.The advantage of view pre-generation is that it’s close to free. A little fiddling with your project file, and you get a performance boost on certain operations. But it doesn’t make everything faster.