我正在尝试创建一个SagePay通知模型。我知道MVC模型绑定程序将根据POST名称自动绑定所有属性。
SagePay系统传递以下表单名称:
Status
VendorTxCode
VPSTxId
VPSSignature
StatusDetail
AVSCV2
AddressResult
PostCodeResult
CV2Result
GiftAid
3DSecureStatus
CAVV
AddressStatus
PayerStatus
CardType
Last4Digits
DeclineCode
ExpiryDate
FraudResponse
BankAuthCode
我创建了以下类:
public class NotificationModel
{
public string Status { get; set; }
public string VendorTxCode { get; set; }
public string VPSTxId { get; set; }
public string VPSSignature { get; set; }
public string StatusDetail { get; set; }
public string AVSCV2 { get; set; }
public string AddressResult { get; set; }
public string PostCodeResult { get; set; }
public string CV2Result { get; set; }
public string GiftAid { get; set; }
// When binding the model will MVC ignore the underscore?
public string _3DSecureStatus { get; set; }
public string CAVV { get; set; }
public string AddressStatus { get; set; }
public string PayerStatus { get; set; }
public string CardType { get; set; }
public string Last4Digits { get; set; }
public string DeclineCode { get; set; }
public string ExpiryDate { get; set; }
public string FraudResponse { get; set; }
public string BankAuthCode { get; set; }
}
很遗憾,C#属性名称不能以数字开头。如何让模型绑定器自动将3DSecureStatus的提交名称绑定到属性?