I have a bunch of classificators which will be used quite often. I wan't to preload those entities when my program st开发者_运维技巧arts so that I wouldn't have to do it later when any object references them.
How can this be done in EF4?
There's a long-ish walkthrough here:
How to Cache Entity Framework Reference Data
But profile first. Writing good projections may be faster than materializing entire entities with cached references. Even loading single referenced objects is quite fast. Don't "optimize" stuff which isn't slow.
精彩评论