EntityValidationErrors

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 年 前
После апдейта c 2.50 до 2.60 при сохранении настроек в админке вылетает ошибка:

Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

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.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

Source Error:


Line 39:                 this.Entities.Add(entity);
Line 40:
Line 41:                 this._context.SaveChanges();
Line 42:             }
Line 43:             catch (DbEntityValidationException dbEx)

Source File: D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Libraries\Nop.Data\EfRepository.cs    Line: 41

Stack Trace:


[DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.]
   System.Data.Entity.Internal.InternalContext.SaveChanges() +132
   Nop.Data.EfRepository`1.Insert(T entity) in D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Libraries\Nop.Data\EfRepository.cs:41

[Exception: Property: Comment Error: The Comment field is required.
]
   Nop.Data.EfRepository`1.Insert(T entity) in D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Libraries\Nop.Data\EfRepository.cs:55
   Nop.Services.Logging.DefaultLogger.InsertLog(LogLevel logLevel, String shortMessage, String fullMessage, Customer customer) in D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Libraries\Nop.Services\Logging\DefaultLogger.cs:170
   Nop.Services.Logging.LoggingExtensions.FilteredLog(ILogger logger, LogLevel level, String message, Exception exception, Customer customer) in D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Libraries\Nop.Services\Logging\LoggingExtensions.cs:39
   Nop.Services.Logging.LoggingExtensions.Error(ILogger logger, String message, Exception exception, Customer customer) in D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Libraries\Nop.Services\Logging\LoggingExtensions.cs:23
   Nop.Admin.Controllers.BaseNopController.LogException(Exception exc) in D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Presentation\Nop.Web\Administration\Controllers\BaseNopController.cs:92
   Nop.Admin.Controllers.BaseNopController.OnException(ExceptionContext filterContext) in D:\Documents\Visual Studio 2010\Projects\nopCommerce\260\Presentation\Nop.Web\Administration\Controllers\BaseNopController.cs:37
   System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception) +170
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825450
   System.Web.Mvc.Controller.ExecuteCore() +159
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

Есть ли предположения что не так?
11 年 前
Во время выполнения сайта происходит какая-то ошибка. В сязи  чем создается объект Log для записи в БД. Но этого не происходит, потому что "The Comment field is required." (поле Comment у объекта Log).

Тут чтобы узнать, где имено происходит ошибка, надо:
1. Открыть \Presentation\Nop.Web\Administration\Controllers\BaseNopController.cs
2. Поставить breakpoint в методе LogException(Exception exc)

P.S. Перенес топик в Russian and Ukrainian Forums (теперь есть и такой).
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.