ModelMetadata.FromLambdaExpression has changed in ASP.NET MVC 3 RTM - by Darin Dimitrov

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


25
0
Sign in
to vote
ID 636341 Comments
Status Closed Workarounds
Type Bug Repros 10
Opened 1/16/2011 8:57:08 AM
Access Restriction Public

Description

The ModelMetadata.FromLambdaExpression<TModel, TProperty> method has changed in ASP.NET MVC 3 RTM causing troubles when migrating an existing ASP.NET MVC 2.0 application using inheritance in view models.

See this StackOverflow question for more information: http://stackoverflow.com/questions/4702483/asp-net-mvc-3-htmlhelper-exception-does-not-recognize-modelmetadata-on-inherited/4702788
Sign in to post a comment.
Posted by Microsoft on 4/21/2011 at 4:10 PM
Hi Darin (and others),

This was a deliberate change that we introduced to ASP.NET MVC 3 that was the result of a trade-off between having better support for inherited models or better support for models that implement interfaces. We ended up favoring inherited models, which from our experience is a more common approach.

The fundamental problem is that when an interface is implemented by a class that the class doesn't *really* inherit any of the members of the interface. The key here is that because it doesn't inherit the members of the interface, it also does not inherit the metadata on those members.

Thanks,
The ASP.NET Team
Posted by Microsoft on 1/16/2011 at 10:48 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by Microsoft on 1/16/2011 at 9:16 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)