使用 Nhibernate Validator 进行 xVal 日期验证

发布于 2024-08-17 04:53:39 字数 376 浏览 7 评论 0原文

我将 xVal 与 NHibernate Validator 一起使用,但我很难验证日期。

首先,NHibernate 没有对日期/日期时间格式的验证(过去和未来除外)。其次,我尝试了 xVal 本身(不使用 NHibernate Validator),但仍然没有机会。

我需要验证日期值(假设在文本框中),以确保它是有效的日期。例如,13/01/2010 或 11/31/2010 不是有效日期。

我尝试通过扩展一个新类来为 NHibernate Validator 创建新规则,但它也需要在 xVal 客户端中声明。如果可能的话,我不喜欢覆盖现有脚本。我还使用了 xval 的 [DataType(DataType.Date)] 但它不检查日期是否有效!

有什么建议吗?

I am using xVal with NHibernate Validator and I have a hard time to validate the dates.

First, NHibernate does not have validation for Date/DateTime formatting (except Past and Future). Second, I tried xVal itself (not using NHibernate Validator) but still no chance.

I need to validate the date values (let's say in a text box), to make sure it's a valid date. For instance, 13/01/2010 or 11/31/2010 are not valid dates.

I have tried creating new rules for NHibernate Validator by extending a new class, but it needs to be declared in the xVal client side too. I don't like to overwrite the existing scripts, if possible. I also used xval's [DataType(DataType.Date)] but it doesn't check if the date is valid!

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假情假意假温柔 2024-08-24 04:53:39

在这个问题上花了一些时间后,这是我的问题的答案: xVal 中的自定义验证

After spending some time on this issue, here is the answer to my question: Custom Validation in xVal

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文