Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created October 22, 2012 05:54
Show Gist options
  • Save jmarnold/3929913 to your computer and use it in GitHub Desktop.
Save jmarnold/3929913 to your computer and use it in GitHub Desktop.
FubuMVC.Json
public static class BindingJsonExtensions
{
public static void UseJsonBinding(this BehaviorChain chain)
{
chain.ApplyConneg();
chain.Output.AddFormatter<JsonFormatter>();
chain.Input.ClearAll();
chain.Input.Readers.Prepend(new NewtonSoftReaderNode(chain.InputType()));
}
}
public class MyFubuRegistry : FubuRegistry
{
public MyFubuRegistry()
{
// some stuff...
// Could obviously do this much more conventional
Configure(graph =>
{
var contacts = graph.BehaviorFor<CreateContactController>(x => x.post_contacts_update(null));
contacts.UseJsonBinding();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment