Tag: 数据数据注释

如何忽略MetadataType属性中缺少的字段?

我有映射到ViewModels的DTO。 为了避免必须管理validation属性(和其他属性),我想在单个类上为所有属性编写validation属性,并在我的ViewModel上重用它。 但是,当我尝试在没有DTO的所有属性的ViewModel上使用元数据时(所有这些都属于……),它给了我一个System.InvalidOperationExceptionexception。 例外: Le type de métadonnées associé pour le type ‘MyProject.EntityViewModel’ contient les propriétés ou champs inconnus suivants : AnotherProperty. Vérifiez que les noms de ces membres correspondent aux noms des propriétés du type principal. 谷歌翻译: The type associated metadata for type ‘MyProject.EntityViewModel’ contains the following unknown properties or fields: AnotherProperty. Verify that […]