ASP.NET IronPython

Browse by Tags

All Tags » T4MVC (RSS)
T4MVC 2.6.20, and upcoming T4MVC talk at MvcConf
I just pushed T4MVC out to the MvcContrib CodePlex site.  You can go to the T4MVC Home Page to get started with it. Last time I blogged about a T4MVC release was for 2.6.13.  In the mean time, I released 2.6.14 and 2.6.15, but they were minor updates so I just tweeted them.  You can check out the history page to see what they changed.  Now, 2.5.20 brings a more interesting new feature, so I figured I’d blog it. New feature to easily render Partials   Update (7/20/2010) : there was a small issue with this change when multiple ascx have the same name.  I just pushed a new 2.6.21 build which addresses it. This new feature was written by Evan Nagle (who is also the author of the Chirpy add-in I discussed a few days...
Check out Chirpy, a very cool Add-In to run T4MVC and do many other cool things
Just a quick post to point folks to a very cool CodePlex Add-In that you may not know about.  It’s called Chirpy and can be downloaded from http://chirpy.codeplex.com/ .  The reason I discovered it is that it includes functionality to automatically run T4MVC.  In fact, it is basically the new version of the Add-In by Wayne Brantley that I blogged about a few months back.  Wayne has been working on this with Evan Nagle , who is the main owner. But note that Chirpy does a lot more than just run T4MVC automatically!  Check out Evan’s post for a complete tutorial.  To give a really quick intro, Chirpy makes it really easy to automatically: Minify your JavaScript files, using a selction of popular engines like YUI and...
An even better way to run T4MVC: a VS AddIn
Last week, I blogged about a nice way of auto-running T4MVC by using the Macro IDE to write an OnBuildBegin event handler .  This was a big improvement over the hacky ‘AlwaysKeepTemplateDirty’ flag that we’ve been using since T4MVC’s early days. Since then, Wayne Brantley has taken this idea to the next level by turning it into a Visual Studio AddIn.  Check out his post and give it a try! The nice benefits of the AddIn over directly handling VS events in the macro IDE are: Simpler install : you drop a couple files in the AddIn folder and it just works Encapsulation : all the code related to this is in one binary Easy to disable : once the AddIn is installed, you can just go in Tools / AddIn Manager to turn it on or off Note that Wayne...
A better way to auto-run T4MVC when you build
T4MVC has always struggled with finding the right way of running automatically when you build.  Being a T4 template in your project, by default it just runs when you save it.  This is not great, because you really want it to rerun whenever you make a change that affects it: e.g. new controller action, new static file, … So I had come up with a pretty crazy workaround (the AlwaysKeepTemplateDirty flag), described in details in this previous post (under “ The T4 file automatically runs whenever you build ”).  It’s a pretty hacky technique, which mostly works but has some nasty quirks: You need to open and save it once to start the save ‘cycle’ You need to leave it open It’s always marked as dirty, which is an annoyance.  The...
T4MVC 2.6.13: now officially in MvcContrib, with a few new features
To get the latest build of T4MVC: Go to MvcContrib T4MVC page on CodePlex   A few weeks back, we announced (mostly on Twitter) that T4MVC was moving into the MvcContrib Codeplex project.  I didn’t say much about it at the time because there wasn’t a whole lot to say yet, in the sense that the move had not actually happened.  MvcContrib was transitioning from github to Mercurial, and since I wasn’t familiar with either one, I figured I’d wait for that and only have to learn Mercurial. So to make it short, all of this has finally happen, and we can now say that T4MVC is officially part of MvcContrib!  Many thanks to Eric Hexter and Jeremy Skinner for helping make this possible.   So what difference does it make for it...
T4MVC 2.6.10: fluent route value API, shorter way to refer to action, and more
To get the latest build of T4MVC: Go to T4MVC page on CodePlex   I just posted build 2.6.10.  There were also a few builds in between since I last blogged about 2.6, so this post describes some of those changes (full history here ).   Fluent route value API As you probably know, T4MVC uses a pattern where the route values are encapsulated using a pseudo-call to a controller action, e.g. Html.ActionLink("Delete Dinner", MVC.Dinners.Delete(Model.DinnerID)) This adds the controller, the action and the method parameters to the route values in a convenient way with no hard coded strings. But in some situation, you may need to add extra values to the route that don’t exist in the action method.  Now you can do it as follows...
T4MVC 2.6: MVC 2 Areas support
To get the latest build of T4MVC: Go to T4MVC page on CodePlex   One of MVC 2's major new features is the support for breaking up a large application into "Areas". This works by following a structure that looks like: Root folder Models Views Controllers Areas NerdDinner Models Views Controllers Blog Models Views Controllers So basically you still have your top level Models/Views/Controllers folders, and in addition to that you can have an arbitrary number of “Areas”, each having their own set of Models/Views/Controllers folders. Starting with MVC 2.6, T4MVC lets you use areas in much the same way it lets you access top level items.  e.g. you can now write: <%= Html.ActionLink("Delete Dinner", MVC.NerdDinner...
T4MVC now has a real home and a dedicated forum!
Up until now, most things related to T4MVC were happening through my various blog posts about it.  And while that was sort of working ok for a while, it was also less than ideal for a couple reasons. First, there was no single place to go to in order to get information about it.  You’d basically have to go through the various posts that describe the various features as they were added.  And as the number of posts grew, so did the pain involved in doing that. The second issue is that there was no good place to discuss it, ask questions and report issues.  So all of those things were mostly just happening organically as comments in my various posts, which really doesn’t work so well.  Blog Post comments don’t support threading...
T4MVC 2.5.01: added support for Html.RenderAction and Html.Action
To get the latest build of T4MVC: Go to download page on CodePlex   MVC 2 Beta introduces two nice helpers called Html.RenderAction and Html.Action.  Phil Haack described them in detail on his blog , so you may want to read through that before reading this post. Basically, they’re two additional methods that follow the standard MVC pattern of passing the controller name and action name as literal strings, and the action parameters as anonymous objects.  e.g. Copying from Phil’s example, if you have an Action like this: public ActionResult Menu(MenuOptions options) { return PartialView(options); } You can write this in your View: <%= Html.Action("Menu", new { options = new MenuOptions { Width=400, Height=500} })%>...
T4MVC 2.5.00 update: multiple output files and minified javascript support
To get the latest build of T4MVC: Go to download page on CodePlex   T4MVC build 2.5.00 brings a couple of fun new features that I’ll describe in this post.  I can’t take too much credit for them as they came from users who suggested them to me, and helped out getting the code going.   Support for multiple output files Up until now, T4MVC.tt has always generated a single file, which is the T4MVC.cs that you see get nested under it in VS.  And normally, this is the way T4 templates work: they just generate one file.  But last week I got an email from Stuart Leeks who pointed me to a new blog post from Damien Guard that describes a nice way to get around this description.  All of Damien’s logic is very nicely encapsulated...
More Posts Next page »