Asp.net mvc 更新Nop Commerce中的现有实体时出错

Asp.net mvc 更新Nop Commerce中的现有实体时出错,asp.net-mvc,nopcommerce,Asp.net Mvc,Nopcommerce,我在学习教程 我成功地更改了数据模型。但是,当我试图更改演示模型时,出现了以下错误。我怎样才能修好它 类别验证人: 我对源代码(演示文稿)所做的更改 此错误是因为添加验证的长度超过一次 只需更改这一行: this.Property(m => m.SomeNewProperty).HasMaxLength(255).IsOptional(); 致: 此错误是因为添加验证的长度超过一次 只需更改这一行: this.Property(m => m.SomeNewProperty).H

我在学习教程

我成功地更改了数据模型。但是,当我试图更改演示模型时,出现了以下错误。我怎样才能修好它

类别验证人:

我对源代码(演示文稿)所做的更改


此错误是因为添加验证的长度超过一次

只需更改这一行:

this.Property(m => m.SomeNewProperty).HasMaxLength(255).IsOptional();  
致:


此错误是因为添加验证的长度超过一次

只需更改这一行:

this.Property(m => m.SomeNewProperty).HasMaxLength(255).IsOptional();  
致:


我不确定您需要什么信息?好的,转到文档链接,找到这一行(//我认为这段代码可以自己说话),并签入您的代码,您已经添加了
RuleFor(m=>m.SomeNewProperty).Length(0,255)或否。是的,我添加了该行。好的,请将该代码添加到问题中。删除这行
RuleFor(m=>m.SomeNewProperty)。长度(0,255)并检查。我不确定您需要什么信息?好的,转到文档链接并找到这一行(//我认为这段代码可以自己说话),然后检查您的代码,您已经添加了
RuleFor(m=>m.SomeNewProperty).Length(0,255)或否。是的,我添加了该行。好的,请将该代码添加到问题中。删除这行
RuleFor(m=>m.SomeNewProperty)。长度(0,255)并检查。我认为NOP Comm文档需要更新。谢谢你的帮助是的,我想我们可以在创建一个请求并请求更改它。我认为NOP Comm文档需要更新。谢谢你的帮助是的,我想我们可以在创建一个请求并请求更改它。
   <div class="form-group">
      <div class="col-md-3">
         @Html.NopLabelFor(model=> model.SomeNewProperty)
        </div>
       <div class="co-md-9">
          @Html.NopEditorFor(model=>model.SomeNewProperty)
          @Html.ValidationMessageFor(model=>model.SomeNewProperty)
        </div>
     </div>
Server Error in '/' Application.

Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: length

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: length


Source Error: 


Line 414:            htmlAttributes = new { @class = "form-control" };
Line 415:
Line 416:            result.Append(helper.EditorFor(expression, new { htmlAttributes }));
Line 417:
Line 418:            return MvcHtmlString.Create(result.ToString());

Source File: c:\newfolder\nopCommerce\nopCommerce_3.80_Source\Presentation\Nop.Web.Framework\HtmlExtensions.cs Line: 416 

Stack Trace: 


[InvalidOperationException: Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: length]
    System.Web.Mvc.UnobtrusiveValidationAttributesGenerator.ValidateUnobtrusiveValidationRule(ModelClientValidationRule rule, IDictionary`2 resultsDictionary, String dictionaryKey) +910
       System.Web.Mvc.UnobtrusiveValidationAttributesGenerator.GetValidationAttributes(IEnumerable`1 clientRules, IDictionary`2 results) +135
       System.Web.Mvc.HtmlHelper.GetUnobtrusiveValidationAttributes(String name, ModelMetadata metadata) +265
       System.Web.Mvc.Html.InputExtensions.InputHelper(HtmlHelper htmlHelper, InputType inputType, ModelMetadata metadata, String name, Object value, Boolean useViewData, Boolean isChecked, Boolean setId, Boolean isExplicitValue, String format, IDictionary`2 htmlAttributes)
+723
       System.Web.Mvc.Html.DefaultEditorTemplates.HtmlInputTemplateHelper(HtmlHelper html, String inputType, Object value) +68
this.Property(m => m.SomeNewProperty).HasMaxLength(255).IsOptional();  
this.Property(m => m.SomeNewProperty).IsOptional();