ASP.NET MVC is there an attribute for a ViewModel/Dto property which causes the modelbinder/view to ignore it?
I have a property in a dto that I don't want the modelbinder/view to use the get on? I开发者_C百科s there an attribute I can decorate it with to stop them from interrogating it?
Thanks
public class Model
{
[Bindable(false)] // this is the attribute you can use...
public int ModelId { get; set; }
}
See the "Include" and "Exclude" properties on the BindAttribute:
http://msdn.microsoft.com/en-us/library/system.web.mvc.bindattribute_members.aspx
精彩评论