Fubu Upgrade

17 views
Skip to first unread message

Ryan Kelley

unread,
Feb 3, 2012, 11:52:32 AM2/3/12
to FubuMVC Development Group
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.

Ryan Kelley

unread,
Feb 6, 2012, 3:57:31 PM2/6/12
to FubuMVC Development Group
Not to be "That Guy" but does anyone have any advice on this?

Jeremy D. Miller

unread,
Feb 6, 2012, 4:15:38 PM2/6/12
to fubumv...@googlegroups.com
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
jeremy...@yahoo.com



From: Ryan Kelley <rpke...@gmail.com>
To: FubuMVC Development Group <fubumv...@googlegroups.com>
Sent: Mon, February 6, 2012 2:57:31 PM
Subject: [fubumvc] Re: Fubu Upgrade
--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To post to this group, send email to fubumv...@googlegroups.com.
To unsubscribe from this group, send email to fubumvc-devel+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.

Reply all
Reply to author
Forward
0 new messages