如何编写自定义模型绑定器 [英] How to write a custom model binder
本文介绍了如何编写自定义模型绑定器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用asp.net mvc进行支付屏幕的开发,我有一个PaymentModel并且想要使用自定义模型绑定器
,有人可以帮助我如何实现自定义模型绑定器吗?在此先感谢。
这是模特课:
< span class =code-keyword> public class PaymentModel
{
public JobPayment JobPayment {get; set ;}
}
公共类JobPayment
{
public decimal InstallCharge {get; set ;}
public CreditCard creditcard {get; set ;}
}
公共类creditCard
{
public string NameOnCard {get; set ;}
public string AccountNumber {get ; set ;}
pub lic 日期 ExpirationDate {get; set ;}
}
解决方案
请看这里:
ASP.NET MVC Custom Model Binder [ ^ ]
ASP.NET MVC模型绑定简介 - 绝对初学者教程 [ ^ ]
I am doing development for a payment screen using asp.net mvc, I have a PaymentModel and want to
use a custom model binder, can someone help me how to implement a custom model binder? Thanks in advance.
Here is model class:
public class PaymentModel
{
public JobPayment JobPayment {get;set;}
}
Public class JobPayment
{
public decimal InstallCharge {get;set;}
public CreditCard creditcard {get;set;}
}
Public class creditCard
{
public string NameOnCard {get;set;}
public string AccountNumber {get;set;}
public Date ExpirationDate {get;set;}
}
解决方案
Please, have a look here:
ASP.NET MVC Custom Model Binder[^]
Introduction to ASP.NET MVC Model Binding - An Absolute Beginner's Tutorial[^]
这篇关于如何编写自定义模型绑定器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文