Created
October 22, 2012 05:54
-
-
Save jmarnold/3929913 to your computer and use it in GitHub Desktop.
FubuMVC.Json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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