Using EF5.0 and view compilation, i can see it all working.
Im see from the call stack the view gets called.
The edmx property metadata artifact processing is set as embed in assembly
This method below (constructor) gets called. But how did it know the name?
Can i have multiple models in 1 assembly ?
Im happy it works, but id like to know what is going on underneath.
Any ideas?
public ViewsForBaseEntitySetsFE35229A04DD6E5585E40F6CE4FBC33EE6C9199EBD58235921B21B951250FF67()
{
this.EdmEntityContainerName = "BosMasterEntities";
this.StoreEntityContainerName = "BosMasterModelStoreContainer";
this.HashOverMappingClosure = "0edb68dd82ba8436bcabb10d30d018482670a8944e1013c90d795d35afea1b8d";
this.HashOverAllExtentViews = "d0d326d5289ea43aa6ea7854e053ba0bd410789e3196101e38bace646c0fa404";
this.ViewCount = 34;
}
You are actually missing two important pieces of information in the code snipped – the code looks more like this:
Firstly, there is an assembly level attribute of type EntityViewGenerationAttribute. Only assemblies that have this attribute will be considered as ones that can contain views. If you look closely at the attribute you will see that this attribute has the type of the class that contains views. You can have multiple EntityViewGenerationAttribute in one assembly. Secondly, the class containing views is derived from EntityViewContainer. If the type specified in the EntityViewGenerationAttribute is not derived from EntityViewContainer EF will throw.