问题描述
目前我的业务对象实施 IDataErrorInfo
。既然我打算在ASP.NET MVC 3使用这些库,我想我应该落实 IValidatableObject
以及或者代替。
Currently my business objects implement IDataErrorInfo
. Since I intend to use these libraries in ASP.NET MVC 3, I figure I should implement IValidatableObject
as well or maybe instead of.
WPF是否与工作 IValidatableObject
?
如何做的DataAnnotations融入了吗?
How do DataAnnotations fit into the picture?
推荐答案
IValidatableObject
是检验整个对象级别的错误的接口。这是你的责任,通过验证数据注解或其他技术来implemts它。 MVC有那么你可以使用它们没有任何进一步的支持数据注解的原生支持。
IValidatableObject
is an interface for verifying whole object level errors. It is your responsibility to implemts it by verifying data annotations or other techniques. MVC has native support for data annotations so you can just use them without any further support.
在WPF只支持相反 IDataErrorInfo
。它有一个 IValidateObject
不支持或的DataAnnotations。
On the contrary wpf ONLY SUPPORTS IDataErrorInfo
. It has no support for IValidateObject
or DataAnnotations.
不过我实现了,在WPF中添加DataAnnotation支持,被包装对象的包装对象。该配料也 IPropertyChanged
的实施。请参阅验证工具包的WPF和Silverlight 在codePLEX
However I implemented a wrapper object that add DataAnnotation support in Wpf to the wrapped object. It furnishes also an implementation of IPropertyChanged
. See the Validation Toolkit for Wpf and Silverlight on codeplex
这篇关于IDataErrorInfo VS IValidatableObject?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!