additional changes to existing types and members for ASP.NET MVC 2 Preview 2
The following additional changes have been made to existing types and members for ASP.NET MVC 2 Preview 2.
· Removed the IsNullableValueType property from the TemplateInfo class and added it to ModelMetadata. When ASP.NET MVC looks up a template for Nullable<T>, the type of T is used for the type-based template lookup. This new property lets the template author know that the original value was a nullable type.
· Changed the Controller.Execute method to throw an exception when it is called more than once on the same instance. Controllers are meant to serve a single request and to be executed only once. Many developers were running into subtle bugs when they accidentally set an Inversion of Control (IoC) container to return a singleton instance of a controller rather than a new instance per request. This change makes the contract for controllers explicit.
· Changed templated helpers to return their output as a string rather than writing the output directly to the response. Before this change, the helpers returned an empty string and wrote their output directly to the response.
· Changed the Controller class so that it no longer inherits from MarshalByRefObject.
· Added support for the DataType.Password enumeration value for the DataTypeAttribute class. When a property is marked with this attribute, the default editor template will render a password input element.
· Made the AuthorizationContext(ControllerContext context) constructor obsolete. Instead, use the constructor that accepts both a ControllerContext parameter and an ActionDescriptor parameter.
· Made performance improvements to expression-based helper methods such as the template helpers. Helpers now cache compiled LINQ expressions.
· Added TemplateInfo.GetFullHtmlID and Html.GenerateIDFromName methods that are used to generate the recommended HTML id attribute value for an element within a template. This helps template authors make sure their templates work when they are nested in other templates.
· Added new attributes for simple REST scenarios, including HttpPutAttribute, HttpDeleteAttribute, and HttpGetAttribute. For more information, see Overriding the HTTP Method Override Verb earlier in this document.
· Changed the default editor template for nullable Boolean values to render a drop-down list that has three options: “Not Set”, “True”, and “False”. When “Not Set” is selected, the value that is submitted to the server is an empty string.
· Changed model types so that they can be either value types or reference types. This allows view pages and other types to support built-in .NET Framework value types such as System.DateTime and System.Int32.
· Changed the framework so that if a controller namespace is specified as part of a route registration (for example, by using the namespaces parameter in a call to the MapRoute method), the framework now looks in that namespace and its children for potential controller matches. For example, if the namespace MyNamespace is specified, the framework will look in the equivalent of MyNamespace.* for a matching controller.
· Renamed the htmlFieldPrefixId parameter for the template helper methods to htmlFieldPrefixName, and renamed TemplateInfo.GetFullHtmlFieldId renamed to TemplatInfo.GetFullHtmlFieldName. The new names better represent the purpose of the parameter and property.
Posted in: programming asp.net | Tags: asp.net asp.net mvc mvc 2 preview 2 httpgetattribute httpdeleteattribute marshalbyrefobject templateinfo getfullhtmlid generateidfromname nullable htmlfieldprefixid getfullhtmlfieldname