I am looking for some guidance on how to tweak the T4 code generation of the entity classes in EntityModel.tt and possibly EntityModel.Context.tt (I'm using POCO classes) to force any queries on entities to use stored procedures (I already have the EntitySQL.tt generating all my Stored procedures)
For example, something like
context.MyEntities().Single(c => c.id == 5)
Would not generate SQL, but would call the SP `sp_GetMyEntities'
If you have a better strategy for achieving the same result I would be glad to learn about it.
UPDATE
At this point I'm interested only in the READ part of CRUD. And there are no joins. Just simple loading of a single entity by ID. Theoretically the SP can be set to accept the ID of the loaded item as a parameter, to avoid loading the whole table (in this case there will be bn need for the .Single(c => c.id == 5) part and ID will be provided to the MyEntities object.
This is for a "database first" implementation
READpart of CRUD. And there are no joins. Just clean loading of a single entity by ID. In terms if effiency, lets assume I have good reasons to create this "headache" :)