r/ASPNET • u/skrowl • Oct 12 '12
Entity Framework + MVC 4 + Knockout.js AddView templates?
I've been messing around with knockout.js a little bit lately and it seems like it has a lot of promise. However, I can't seem to find any good Code Templates (aka t4 templates or .tt files) for it.
My GUESS is that the only changes that we would need would be on the view side, not the controller side, but I'd be up for looking at new controller templates too.
Where I am right now:
Create a new MVC 4 project
Using NuGet, install entity framework 5, jquery, jquery ui, and knockout
Create a .edmx model by reverse engineering your existing database with Entity Framework
Drag C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC 4\CodeTemplates from Explorer into the root of your project
Delete CodeTemplates\AddController
Highlight all of the items in CodeTemplates\AddView\CSHTML and blank out the text in "Custom Tool" in properties to keep them from building
Start screwing around with Create.tt and Edit.tt to add in knockout code.
Final Goal Expected Input: Right Click > Add Controller ... > MVC Controller using EF
Final Goal Expected Result: Controller & View created using EF with knockout code already in place.
If you use something similar to knockout that you like more, I'd love to hear about it!
Thanks for your time!