System.ComponentModel.dataAnnotations.CustomValidation
任何人都可以帮助我了解 System.ComponentModel.dataAnnotations.CustomValidation 的完整示例。
这是我的场景,
我有 EventMetadata & EventAttributeMetadata 类。在 EventMetadata 中,我有 Startdate &结束日期财产和在 EventAttributeMetadata 中,我有 HoldOutdate 属性。我想对 HoldOutdate 属性执行以下验证。 “保留日期应介于活动开始日期和结束日期之间”。这应该使用 System.ComponentModel.dataAnnotations 命名空间。
can anyone please help me with full expmple of System.ComponentModel.dataAnnotations.CustomValidation.
This is my scnario
I have EventMetadata & EventAttributeMetadata class. In EventMetadata i have Startdate & Enddate Property & In EventAttributeMetadata i have HoldOutdate Propety. I want perform following validation for HoldOutdate property. "Holdout Date should be between event start date & end date". this should be using System.ComponentModel.dataAnnotations namespace.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个例子是在你创建一个不为空的默认mvc应用程序时创建的AccountModel中,根据你的需要和使用修改它。
This example is in the AccountModel that is created when you make a default mvc app that is not empty modify it to your need and use.