October 2010 Entries

Extending MVC Views with DynamicObject

The other day I was working on some features for MVC Turbine when I got a random idea about how we can use a new feature that comes with the Razor view engine (VE). This blog post hopefully will help out some of you in your development or least get your creative juices going. @View with Razor Views One of the new features that ships with the Razor VE is the ability to set ViewDataDictionary values through the use of a DynamicObject property. The following code shows how to do this: The ViewModel.Message call is the...

posted @ Thursday, October 21, 2010 12:45 AM | Feedback (809)

Dependency Injection for Filters in MVC3

One of the new features of the Dependency Inject (DI) components from MVC3 is something called a IFilterProvider.  The purpose of this component is to provide a simpler way for MVC applications to interact with filters (action, exception, result, etc.). In the previous versions, trying to achieve something like providing DI support to filters was doable, it just required deeper integration into the MVC runtime.  The IFilterProvider interface is defined as: As you can see, it’s a pretty simple interface that can enable lots of opportunities if used in the right context.  The MVC bits ship with an...

posted @ Tuesday, October 12, 2010 11:37 PM | Feedback (1579)

POCO Results for MVC Actions

Lately, I’ve been working a lot with applications that expose JSON-based services to clients that care to consume their data. All of these services are nothing more than plain Controllers that return a ViewModel that’s rendered as JSON. You might be saying to yourself, “Big deal! All you’re doing is returning a JsonResult to the client! Tell us something new…” Well, as a matter of fact, that’s the whole purpose of this post. ;) How Do Things Currently Work? Right now within MVC, you have a explicit convention that a controller must follow for any action it exposes;...

posted @ Wednesday, October 6, 2010 11:51 PM | Feedback (3978)