ASP.Net MVC 3 ViewModel Data Annotations
问题 I am developing an ASP.Net MVC 3 Web application with Entity Framework 4.1 and I am getting a bit confused with regards using Data Annotations for form validation. I always return a ViewModel to a View as opposed to passing the actual object as I realise this is poor practice. For example: public class ViewModelTeam { public Team Team { get; set; } } My View might then have something like this @model UI.ViewModels.ViewModelTeam @Html.HiddenFor(model => model.Team.teamID) <div class="editor