dotvvm 验证问题

Problems with dotvvm Validation

查看有关使用验证器的文档

If you want to validate some property, just use standard attributes from the System.ComponentModel.DataAnnotations namespace. DotVVM can translate some validation rules into javascript, so the validation can be executed also on the client side.

然后我开发了如下代码:

using System;
using DotVVM.Framework.ViewModel;
using APP_MIS_FACTURAS.Models;
using System.Web;
using DotVVM.Framework.Controls.Bootstrap;
using System.ComponentModel.DataAnnotations;

namespace APP_MIS_FACTURAS.ViewModels
{
    public class InicioViewModel : DotvvmViewModelBase
    {

        [Required(ErrorMessage = "No se indica la contraseña del usuario")]
        public string usuario { get; set; }
        public string password { get; set; }

    }
}

但我收到以下错误:

Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'Required' could not be found (are you missing a using directive or an assembly reference?) APP_MIS_FACTURAS C:\Users\leojfn\Documents\Visual Studio 2015\Projects\Cystem\APP_MIS_FACTURAS\APP_MIS_FACTURAS\ViewModels\InicioViewModel.cs 45 Active

我不知道我是否需要导入一些特定的库或者我需要安装一些 NuGetPackage

在解决方案资源管理器中右键单击项目 window,选择添加引用并选择 select System.ComponentModel.DataAnnotations。 默认情况下不引用它,但它包含在 .NET Framework 中。