开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜