gpt4 book ai didi

jquery - MVC 4 : How to use the “partial validation” technique?

转载 作者:行者123 更新时间:2023-12-02 10:55:38 26 4
gpt4 key购买 nike

我也需要在MVC 4上实现“部分验证技术”,如this answer中所述:

      public class DontValidateEmailAttribute : ActionFilterAttribute 
{ public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var modelState = filterContext.Controller.ViewData.ModelState;
var incomingValues = filterContext.Controller.ValueProvider;
var key = modelState.Keys.Single(x => incomingValues.Equals("Email"));
modelState[key].Errors.Clear();
}
}

但是我得到以下 编译错误:“ 'System.Collections.Generic.ICollection<string>' does not contain a definition for 'Single' and no extension method 'Single' accepting a first argument of type 'System.Collections.Generic.ICollection<string>' could be found (are you missing a using directive or an assembly reference?) ...”

谢谢

最佳答案

您在顶部缺少using System.Linq吗?

关于jquery - MVC 4 : How to use the “partial validation” technique?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9511794/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com