The build in conneg stuff will do that.
You just need to build a convention like so:
// Need to register this as a policy so that it happens *after* the view
attachment
public class RyanEnumerableJsonConvention : IConfigurationAction
{
public void Configure(BehaviorGraph graph)
{
graph.Behaviors
.Where(x => x.ActionOutputType().CanBeCastTo<IEnumerable>())
.Each(x => x.MakeAsymmetricJson());
}
}
Jeremy D. Miller
The Shade Tree Developer
jeremydmil...@yahoo.com
________________________________
From: Ryan Kelley <rpkel...@gmail.com>
To: FubuMVC Development Group <fubumvc-devel@googlegroups.com>
Sent: Mon, February 6, 2012 2:57:31 PM
Subject: [fubumvc] Re: Fubu Upgrade
Not to be "That Guy" but does anyone have any advice on this?
On Feb 3, 10:52 am, Ryan Kelley <rpkel...@gmail.com> wrote:
> So I am finally getting around to upgrading our Fubu Bits at Nine
> Collective, I will likely have more issue that just this one, but
> figured I would start here.
> https://gist.github.com/1724029
> We had/have VariableOutput Convention that would like at the
> OutputType of an action and if it could be cast to IEnumerable it
> would send the output as json when the request header was set
> properly, otherwise would return the webform view.
> I believe there was some functionality that took care of this built
> into the framework back in the fall but I can not figure out how to
> make it work properly. Any help would be much appreciated.
--
You received this message because you are subscribed to the Google Groups
"FubuMVC Development Group" group.
To post to this group, send email to fubumvc-devel@googlegroups.com.
To unsubscribe from this group, send email to
fubumvc-devel+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/fubumvc-devel?hl=en.