We generate our web api. This saves time and makes access uniform. But there are some rules we have to obey to get this working.
With Entity Framework Model First (edmx) we generate our data layer. By customising the template we add an interface and some extra features for better abstraction. The model classes will become our Data Transfer Objects.
Following the Scott Hanselman blogpost we edited the mvc template to generate the web api as we like it to be. During the transformation we query the database for indexes and use that information to generate the queries.
Thanks to “old” techniques as T4 we can automate our “new” technology. 😉