This is a bad idea. Especially if you plan to build the application further. This is a road to performance bottlenecks and OutOfMemory exceptions.
And I found that generic repositories are also anti-pattern. With time you'll realise that you'll need to add more and more functions within that Get
method and eventually it will just copy implementation of DbContext
.
In fact, your current implementation does not serve any purpose of isolation. Why not just use DbContext directly?
I recommend dump the idea of Generic stuff and have small Query classes that retrieve only the entities you require in a controlled fashion, not everything for everyone. Have a look at this .
And to answer your question, Entity Framework does not have an option to provide IncludeAll
. You can do a hack with reflection, but I'm not going to give solution here because it is just a bad practice.