我試圖創建Range
與DataAnnotation
鍵入long
號碼,但它總是拋出一個異常,我無法修復它。我認爲這個問題是因爲我需要輸入一個大數字作爲例子07608800000070
然後它會拋出異常。如何使用DataAnnotation的範圍與長類型?
我該如何解決這個問題?
我想
[Range(minimum: 1, maximum: 999999999999999, ErrorMessage = "Type the Parcel ID")]
public long parcelID {get;set;}
異常
A first chance exception of type 'System.OverflowException' occurred in mscorlib.dll
您可以嘗試明確指定數據類型:'[Range(typeof(long),1,999999999999999,ErrorMessage =「輸入包裹ID」)]''。 –