FubuMVC Automatic Binding of Request Properties February, 2012
One very nifty feature of FubuMVC is the automatic binding of request properties to your input model. From what I can tell, any item in the AspNetAgregateDictionary will be bound if the name/type of your input model property match. So for example, the following input model would have the user agent bound to the UserAgent property, talk about loose coupling:
public class InputModel { public string UserAgent { get; set; } }The following items can be bound to your model:
Name | Type |
---|---|
AcceptTypes | string[] |
ApplicationPath | string |
AppRelativeCurrentExecutionFilePath | string |
Browser | System.Web.HttpBrowserCompatibilityBase |
ClientCertificate | System.Web.HttpClientCertificate |
ContentEncoding | System.Text.Encoding |
ContentLength | int |
ContentType | string |
Cookies | System.Web.HttpCookieCollection |
CurrentExecutionFilePath | string |
FilePath | string |
Files | System.Web.HttpFileCollectionBase |
Filter | System.IO.Stream |
Form | System.Collections.Specialized.NameValueCollection |
Headers | System.Collections.Specialized.NameValueCollection |
HttpMethod | string |
IsAuthenticated | bool |
IsLocal | bool |
IsSecureConnection | bool |
LogonUserIdentity | system.Security.Principal.WindowsIdentity |
Params | System.Collections.Specialized.NameValueCollection |
Path | string |
PathInfo | string |
PhysicalApplicationPath | string |
PhysicalPath | string |
QueryString | System.Collections.Specialized.NameValueCollection |
RawUrl | string |
RequestType | string |
ServerVariables | System.Collections.Specialized.NameValueCollection |
TotalBytes | int |
Url | Uri |
UrlReferrer | Uri |
UserAgent | string |
UserHostAddress | string |
UserHostName | string |
UserLanguages | string[] |