Reputation: 12986
I have added this new code template to my VS2013, MVC5 project, which is a template for creating an OData controller using a generic repository pattern.
I expected to see a new template option when creating a controller, however I am unable to find where this new template through Add/New Scaffoded Item..., or any other Add/... menu option.
Update: The template is located in CodeTemplates/ODataControllerWithContext/Controller.cs.t4
How to I go about using this template to generate a new controller?
Upvotes: 0
Views: 125
Reputation: 4520
One word: SideWaffle
Use the asp.net project Templates for Visual Studio 2012/2013 via teh Sidewaffle addin and modify them to have the bits from the controller template you listed.
Add the t4 item templates then modify them. Follow these steps in more detail. "How you can customize the generated contents of the New Scaffoldded Item ": From http://blogs.msdn.com/b/webdev/archive/2013/12/26/how-to-customize-the-generated-files-from-the-new-scaffolded-item-dialog.aspx is a great step by step resource on how to do this.
On the subject Lelong's Generic Unit of Work (which I've started using, and is awesome). He's dropped the template and the EntitySetController file. I can't find the build notes as to why, but you can ask him ... (it was there March 9 and now it's not - he even blogged about it here: https://genericunitofworkandrepositories.codeplex.com/wikipage?title=Services%20Pattern%20Example)
Upvotes: 1