Nested Controllers in the Latest Web API Source

I just happened to drop over to the ASP.NET Web Stack and noticed that nested controllers are now allowed in Web API! This is terrific news for you F# developers who, like me, think that grouping related functionality, including controllers, within modules is a convenient practice. Note, that this is only in the source. You won’t be able to update your NuGet packages to get this functionality, though it is easy to replace the offending DefaultHttpControllerTypeResolver with this updated copy:

Replace DefaultHttpControllerTypeResolver
1
config.Services.Replace(typeof(IHttpControllerTypeResolver), new MyHttpControllerTypeResolver())

Which do you prefer for Frank routing gist…

Which do you prefer for Frank routing?

let myApp = function
| GET "/" _ -> render "Hello world!"
| POST "/order" p -> frank {
createThingFromParams p
do! redirectTo "/" }
let myApp = App [
get "/" (render "Hello world!")
post "/order" (frank {
let! p = getParams
createThingFromParams p
do! redirectTo "/" })
]
let myApp = function
| GET "/" -> render "Hello world!"
| POST "/order" -> frank {
let! p = getParams
createThingFromParams p
do! redirectTo "/" }

Leave a comment to cast your vote.