I’ve been looking around the web but I’ve yet to found any information on this. As we know Linq gives us CompiledQuery which transform the expression into T-SQL before running it. I’m trying to design a generic repository to interact with my EF but with the exception the Linq queries is compiled. If anyone could shead some light on this that would be great 🙂
Share
It is hardly possible because if you want to pre-compile query you must know it. With generic repository you usually have only this:
So the code using a repository instance is responsible for defining the query. Pre-compilation requires concrete repository which will contain methods like:
etc.
Obviously you can hardly prepare such queries in generic repository beacuse they are dependent on concrete entity.