gpt4 book ai didi

ASP.NET MVC 是否有 ViewModel/Dto 属性的属性导致 modelbinder/view 忽略它?

转载 作者:行者123 更新时间:2023-12-02 14:21:16 24 4
gpt4 key购买 nike

我在 dto 中有一个属性,我不希望 modelbinder/view 使用 get on?我可以用一个属性来装饰它以阻止他们询问它吗?

谢谢

最佳答案

public class Model
{
[Bindable(false)] // this is the attribute you can use...
public int ModelId { get; set; }
}

关于ASP.NET MVC 是否有 ViewModel/Dto 属性的属性导致 modelbinder/view 忽略它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2884028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com