0
我有我試圖驗證數據不要使用EntLib Address對象:鑑於以下方法GetType(對象)上的EntLib驗證問題 - 期望字符串不是對象?
:
<ValidatorComposition(CompositionType.And, Ruleset:="FraudAnalysis")> _
<NotNullValidator(MessageTemplate:="Billing address is required.", Ruleset:="FraudAnalysis")> _
<TypeConversionValidator(GetType(Address), MessageTemplate:="Billing address must be an address object.", Ruleset:="FraudAnalysis")> _
Public Property BillingAddress() As Address
Get
Return _BillingAddress
End Get
Set(ByVal value As Address)
_BillingAddress = value
End Set
End Property
我創建一個地址對象:所以現在在
Address thisAddress = new Address();
thisAddress.Address1 = "12312 Long Street";
thisAddress.City = "Los Angeles";
thisAddress.State = "CA";
thisAddress.Zip = "93322";
// set billing address to address
cardX.BillingAddress = thisAddress;
cardX.billingAddress = thisAddress,BillingAddress屬性驗證器(GetType(Address))應該觸發。它似乎着火,但返回此錯誤:
要驗證的值不是預期的類型:預期的System.String,但得到地址,而不是。
任何人都可以在這裏看到問題/建議修復?
謝謝。
這樣做。謝謝。 – ElHaix 2010-02-04 21:56:07