I find it easier to do
let route = routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}" // URL with parameters
)
route.Defaults.Add("controller", "Home")
route.Defaults.Add("action", "Index")
or
[ "controller", "Home"
"action", "Index" ]
|> List.iter route.Defaults.Add
In F#, I would avoid calling overloads that accept anonymous types much as I would avoid calling an F# method accepting FSharpList
from C#. Those are language-specific features. Usually there is a language-agnostic overload/workaround available.
EDIT
Just looked at the docs–here’s yet another way to do it
let inline (=>) a b = a, box b
let defaults = dict [
"controller" => "Home"
"action" => "Index"
]
route.Defaults <- RouteValueDictionary(defaults)