I've discovered I can increase performance of my application by pre-compiling my views using the EdmGen.exe
tool.
This is all well and good, but neither me or my colleges can work out how the generated .cs file is actually used by the project. There doesnt seem to be any references to the class that was generated anywhere, so how is it getting included?
Can anyone shed any light on this as its really rather frustrating not knowing how it works!
EDIT
We've acertained that the EntityViewGenerationAttribute is used to mark the class type for the pre-compiled view, however this must mean its loaded though reflection. If thats the case, is there any way of explicitly putting it in code that a pre-compiled view class should be used for a certain view?
You could try changing the generated code. So that a DIFFERENT view was returned. But if you dont return a view I expect that EF will fail.
The idea is that the generated class is for ALL sets in a DBContext. And indeed if the view doesnt match the context you have (hash comparison) you will get a runtime error.
eg
But for a given view, you could return a different string