MVC 5 实体框架显示名称不允许输入十位数字给出错误 "Value is not valid for"?

MVC 5 Entity Frame work display name not allowing to enter ten digit number giving error "Value is not valid for"?

我的实体 class 中有这个 属性,

[Display(Name = "Phone", ResourceType = typeof(Resources.Resource))]
public Nullable<int> Phone { get; set; }

我输入十位数字,但出现错误

"The value '5698452136' is not valid for"

如果我输入 9 位数字就可以了

我没有应用任何验证只是根据语言显示名称。

但是我删除了显示 属性 它工作正常。为什么它给我验证错误?

已编辑:

抱歉,我在我的必需属性上犯了错误,它给出了这个错误,

 [Required(ErrorMessageResourceType = typeof(Resources.Resource),
          ErrorMessageResourceName = "PhoneRequired")]

在添加上面的 required 之后我收到了上面提到的错误,如果我删除它就可以正常工作

希望得到您的建议

希望得到您的建议

您想将类型从 int 更改为 long,因为整数的最大值为 2,147,483,647,并且您正试图传递超过上限的 5,698,452,136。

[Display(Name = "Phone", ResourceType = typeof(Resources.Resource))]
[Required(ErrorMessageResourceType = typeof(Resources.Resource),
          ErrorMessageResourceName = "PhoneRequired")]
public Nullable<long> Phone { get; set; }